Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Thomas G. Lopes
commited on
Commit
·
3d3e23c
1
Parent(s):
8e54cb0
fix build
Browse files
src/lib/state/token.svelte.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
|
|
| 1 |
import { safeParse } from "$lib/utils/json.js";
|
| 2 |
-
import { PUBLIC_HF_TOKEN } from "$env/static/public";
|
| 3 |
import typia from "typia";
|
| 4 |
|
| 5 |
const key = "hf_token";
|
|
@@ -9,8 +9,8 @@ class Token {
|
|
| 9 |
writeToLocalStorage = $state(true);
|
| 10 |
|
| 11 |
constructor() {
|
| 12 |
-
if (PUBLIC_HF_TOKEN) {
|
| 13 |
-
this.#value = PUBLIC_HF_TOKEN;
|
| 14 |
return;
|
| 15 |
}
|
| 16 |
|
|
@@ -59,7 +59,7 @@ class Token {
|
|
| 59 |
reset = () => {
|
| 60 |
this.value = "";
|
| 61 |
localStorage.removeItem(key);
|
| 62 |
-
if (!PUBLIC_HF_TOKEN) {
|
| 63 |
this.requestTokenFromParent();
|
| 64 |
}
|
| 65 |
};
|
|
|
|
| 1 |
+
import { env } from "$env/dynamic/public";
|
| 2 |
import { safeParse } from "$lib/utils/json.js";
|
|
|
|
| 3 |
import typia from "typia";
|
| 4 |
|
| 5 |
const key = "hf_token";
|
|
|
|
| 9 |
writeToLocalStorage = $state(true);
|
| 10 |
|
| 11 |
constructor() {
|
| 12 |
+
if (env.PUBLIC_HF_TOKEN) {
|
| 13 |
+
this.#value = env.PUBLIC_HF_TOKEN;
|
| 14 |
return;
|
| 15 |
}
|
| 16 |
|
|
|
|
| 59 |
reset = () => {
|
| 60 |
this.value = "";
|
| 61 |
localStorage.removeItem(key);
|
| 62 |
+
if (!env.PUBLIC_HF_TOKEN) {
|
| 63 |
this.requestTokenFromParent();
|
| 64 |
}
|
| 65 |
};
|