mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 09:04:26 +00:00
- Move lit from dependencies to peerDependencies in web-ui to prevent multiple Lit instances being loaded - Update mini-lit from 0.1.8/0.1.10 to 0.2.0 in root package.json and web-ui/package.json - Install @tailwindcss/vite in web-ui/example - Run biome formatting fixes across codebase This resolves HMR custom element re-registration errors caused by duplicate Lit registries.
22 lines
647 B
TypeScript
22 lines
647 B
TypeScript
import PromptDialog from "@mariozechner/mini-lit/dist/PromptDialog.js";
|
|
import { i18n } from "./i18n.js";
|
|
|
|
export async function getAuthToken(): Promise<string | undefined> {
|
|
let authToken: string | undefined = localStorage.getItem(`auth-token`) || "";
|
|
if (authToken) return authToken;
|
|
|
|
while (true) {
|
|
authToken = (
|
|
await PromptDialog.ask(i18n("Enter Auth Token"), i18n("Please enter your auth token."), "", true)
|
|
)?.trim();
|
|
if (authToken) {
|
|
localStorage.setItem(`auth-token`, authToken);
|
|
break;
|
|
}
|
|
}
|
|
return authToken?.trim() || undefined;
|
|
}
|
|
|
|
export async function clearAuthToken() {
|
|
localStorage.removeItem(`auth-token`);
|
|
}
|