CORS Access Control Error Svelte Kit

Hey, I've been trying to do a fetch request on the client instead of the server, I'm hosting a static svelte site on gh pages, so I need to do things on the client. But calling these methods on the client give these errors above. Here is my code:
$effect( () => {
GetFindPackages( "" ).then((res) => {
if ( !res ) return;
packages = res;
});
})
$effect( () => {
GetFindPackages( "" ).then((res) => {
if ( !res ) return;
packages = res;
});
})
export const GetFindPackages = async function (query: string): Promise<SboxPackage[] | null> {
let res = await fetch("https://services.facepunch.com/sbox/package/find");

if (!res.ok) {
return null;
}

let body = await res.json();

let pkgs: SboxPackage[] = body.Packages;

return pkgs;
}
export const GetFindPackages = async function (query: string): Promise<SboxPackage[] | null> {
let res = await fetch("https://services.facepunch.com/sbox/package/find");

if (!res.ok) {
return null;
}

let body = await res.json();

let pkgs: SboxPackage[] = body.Packages;

return pkgs;
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server