File size: 661 Bytes
b1a4d81
22d2310
b1a4d81
 
 
09bd50c
 
0a4b979
7bb6a57
 
22d2310
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { writable } from "svelte/store";
// import cookies from "js-cookie";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const userStore = writable<any>(null);

export const openWindowLogin = async () => {
  window.open("/api/auth/login", "_blank");
};

// export const loginFromCode = async (code: string) => {
//   const request = await fetch(`/api/auth`, {
//     method: "POST",
//     body: JSON.stringify({ code }),
//   });
//   const { ok, token } = await request.json();
//   if (ok) {
//     cookies.set("hf_access_token", token, { expires: 1, domain: process.env.SPACE_HOST });
//     window.location.reload();
//   }
// };