mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
Watch for empty cookie strings
This commit is contained in:
parent
a489a8d749
commit
7326682c94
@ -336,7 +336,9 @@ export const ChatImpl = memo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loginKey = getNutLoginKey();
|
const loginKey = getNutLoginKey();
|
||||||
const anthropicApiKey = Cookies.get(anthropicApiKeyCookieName);
|
|
||||||
|
const apiKeyCookie = Cookies.get(anthropicApiKeyCookieName);
|
||||||
|
const anthropicApiKey = apiKeyCookie?.length ? apiKeyCookie : undefined;
|
||||||
|
|
||||||
if (!loginKey && !anthropicApiKey) {
|
if (!loginKey && !anthropicApiKey) {
|
||||||
const numFreeUses = +(Cookies.get(anthropicNumFreeUsesCookieName) || 0);
|
const numFreeUses = +(Cookies.get(anthropicNumFreeUsesCookieName) || 0);
|
||||||
|
@ -134,7 +134,8 @@ const nutLoginKeyCookieName = 'nutLoginKey';
|
|||||||
const nutIsAdminCookieName = 'nutIsAdmin';
|
const nutIsAdminCookieName = 'nutIsAdmin';
|
||||||
|
|
||||||
export function getNutLoginKey(): string | undefined {
|
export function getNutLoginKey(): string | undefined {
|
||||||
return Cookies.get(nutLoginKeyCookieName);
|
const cookieValue = Cookies.get(nutLoginKeyCookieName);
|
||||||
|
return cookieValue?.length ? cookieValue : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNutIsAdmin(): boolean {
|
export function getNutIsAdmin(): boolean {
|
||||||
@ -169,7 +170,8 @@ export function setNutIsAdmin(isAdmin: boolean) {
|
|||||||
const nutProblemsUsernameCookieName = 'nutProblemsUsername';
|
const nutProblemsUsernameCookieName = 'nutProblemsUsername';
|
||||||
|
|
||||||
export function getProblemsUsername(): string | undefined {
|
export function getProblemsUsername(): string | undefined {
|
||||||
return Cookies.get(nutProblemsUsernameCookieName);
|
const cookieValue = Cookies.get(nutProblemsUsernameCookieName);
|
||||||
|
return cookieValue?.length ? cookieValue : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function saveProblemsUsername(username: string) {
|
export function saveProblemsUsername(username: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user