Merge commit from fork

* fix(frontend): Improve cookie attributes

* fix(frontend): Delete an old authentication cookie in fetchAccount
This commit is contained in:
nexryai 2025-02-01 13:33:37 +09:00 committed by あわわわとーにゅ
parent 005d1c1a7a
commit 0b3bcc95fd
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB

View file

@ -113,6 +113,9 @@ export async function removeAccount(idOrToken: Account['id']) {
}
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
document.cookie = "token=; path=/; max-age=0";
document.cookie = `token=${token}; path=/queue; max-age=86400; SameSite=Strict; Secure`; // bull dashboardの認証とかで使う
return new Promise((done, fail) => {
const initiateTime = Date.now();
window.fetch(`${apiUrl}/i`, {
@ -230,7 +233,6 @@ export async function login(token: Account['token'], redirect?: string) {
throw reason;
});
miLocalStorage.setItem('account', JSON.stringify(me));
document.cookie = `token=${token}; path=/; max-age=31536000`; // bull dashboardの認証とかで使う
await addAccount(me.id, token);
if (redirect) {