handle errors
This commit is contained in:
parent
dfef859ede
commit
a41ad5fb6e
1 changed files with 40 additions and 37 deletions
|
|
@ -30,11 +30,14 @@ export const getSession = createServerFn({ method: "GET" }).handler(
|
||||||
process.env.VITE_BETTER_AUTH_URL ??
|
process.env.VITE_BETTER_AUTH_URL ??
|
||||||
import.meta.env.VITE_BETTER_AUTH_URL ??
|
import.meta.env.VITE_BETTER_AUTH_URL ??
|
||||||
headers.get("origin") ??
|
headers.get("origin") ??
|
||||||
"http://127.0.0.1:3000";
|
"http://localhost:3000";
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
new URL("/api/auth/get-session", resolvedBaseUrl),
|
new URL("/api/auth/get-session", resolvedBaseUrl),
|
||||||
{ headers },
|
{ headers },
|
||||||
);
|
).catch((e) => {
|
||||||
|
console.error(e);
|
||||||
|
return { ok: false } as const;
|
||||||
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue