mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-26 11:37:40 +02:00
fix CORS issue when fetching users LNURL
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { fetchWithCorsFallback } from "../helpers/cors";
|
||||
import { getLudEndpoint } from "../helpers/lnurl";
|
||||
|
||||
type LNURLPMetadata = {
|
||||
@@ -23,7 +24,9 @@ class LNURLMetadataService {
|
||||
const url = getLudEndpoint(addressOrLNURL);
|
||||
if (!url) return;
|
||||
try {
|
||||
const metadata = await fetch(url).then((res) => res.json() as Promise<LNURLError | LNURLPMetadata>);
|
||||
const metadata = await fetchWithCorsFallback(url).then(
|
||||
(res) => res.json() as Promise<LNURLError | LNURLPMetadata>,
|
||||
);
|
||||
if ((metadata as LNURLPMetadata).tag === "payRequest") {
|
||||
return metadata as LNURLPMetadata;
|
||||
}
|
||||
|
Reference in New Issue
Block a user