fix nostr link handler

This commit is contained in:
Kieran 2023-06-16 12:08:50 +01:00
parent 34f12e5fb5
commit 180ac0da75
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -1,4 +1,4 @@
import { NostrPrefix, parseNostrLink } from "@snort/system";
import { NostrPrefix, tryParseNostrLink } from "@snort/system";
import { useEffect, useState } from "react";
import { FormattedMessage } from "react-intl";
import { useNavigate, useParams } from "react-router-dom";
@ -15,7 +15,7 @@ export default function NostrLinkHandler() {
const link = decodeURIComponent(params["*"] ?? "").toLowerCase();
async function handleLink(link: string) {
const nav = parseNostrLink(link);
const nav = tryParseNostrLink(link);
if (nav) {
if (nav.type === NostrPrefix.Event || nav.type === NostrPrefix.Note || nav.type === NostrPrefix.Address) {
navigate(`/e/${nav.encode()}`);