enzostvs HF staff commited on
Commit
d71e172
·
1 Parent(s): 261e62c

wip signin

Browse files
Files changed (1) hide show
  1. src/routes/login/callback/+page.ts +2 -2
src/routes/login/callback/+page.ts CHANGED
@@ -1,5 +1,5 @@
1
  import cookies from "js-cookie";
2
-
3
  export async function load({ url, fetch }) {
4
  const code = url.searchParams.get("code")
5
 
@@ -12,7 +12,7 @@ export async function load({ url, fetch }) {
12
  const { ok, token } = await request.json();
13
  if (ok) {
14
  cookies.set("hf_access_token", token, { expires: 1, domain: process.env.SPACE_HOST });
15
- window.location.href = "/";
16
  }
17
  }
18
 
 
1
  import cookies from "js-cookie";
2
+ import { redirect } from "@sveltejs/kit";
3
  export async function load({ url, fetch }) {
4
  const code = url.searchParams.get("code")
5
 
 
12
  const { ok, token } = await request.json();
13
  if (ok) {
14
  cookies.set("hf_access_token", token, { expires: 1, domain: process.env.SPACE_HOST });
15
+ throw redirect(302, "/")
16
  }
17
  }
18