fix: fallback to first endpoint
This commit is contained in:
parent
86f13c171d
commit
855a87aadc
@ -49,7 +49,8 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
||||
|
||||
const provider = useMemo(() => (service ? new NostrStreamProvider("", service) : DefaultProvider), [service]);
|
||||
const defaultEndpoint = useMemo(() => {
|
||||
return info?.endpoints.find(a => a.name == (recording ? "Best" : "Good"));
|
||||
return info?.endpoints.find(a => a.name == (recording ? "Best" : "Good"))
|
||||
?? info?.endpoints[0];
|
||||
}, [info, recording]);
|
||||
|
||||
useEffect(() => {
|
||||
@ -98,9 +99,8 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
||||
</h3>
|
||||
<div className="uppercase font-semibold flex items-center gap-2">
|
||||
<div
|
||||
className={`w-3 h-3 rounded-full ${
|
||||
status === StreamState.Live ? "animate-pulse bg-green-500" : "bg-red-500"
|
||||
}`}></div>
|
||||
className={`w-3 h-3 rounded-full ${status === StreamState.Live ? "animate-pulse bg-green-500" : "bg-red-500"
|
||||
}`}></div>
|
||||
{status === StreamState.Live ? (
|
||||
<FormattedMessage defaultMessage="Started" />
|
||||
) : (
|
||||
|
@ -12,7 +12,8 @@ export default function DashboardIntroFinal() {
|
||||
const [info, setInfo] = useState<StreamProviderInfo>();
|
||||
|
||||
const defaultEndpoint = useMemo(() => {
|
||||
return info?.endpoints.find(a => a.name == "Best");
|
||||
return info?.endpoints.find(a => a.name == "Best")
|
||||
?? info?.endpoints[0];
|
||||
}, [info]);
|
||||
|
||||
async function loadInfo() {
|
||||
|
@ -16,7 +16,8 @@ export default function DashboardIntro() {
|
||||
const exampleHours = 4;
|
||||
|
||||
const defaultEndpoint = useMemo(() => {
|
||||
return info?.endpoints.find(a => a.name == "Best");
|
||||
return info?.endpoints.find(a => a.name == "Best")
|
||||
?? info?.endpoints[0];
|
||||
}, [info]);
|
||||
const rate = useRates("BTCUSD");
|
||||
const exampleCost = rate.ask * (exampleHours * (defaultEndpoint?.rate ?? 0) * 60) * 1e-8;
|
||||
|
Loading…
x
Reference in New Issue
Block a user