Merge commit from fork
* fix(frontend): Improve cookie attributes * fix(frontend): Delete an old authentication cookie in fetchAccount
This commit is contained in:
parent
f8f17a44d4
commit
77e421029c
|
@ -101,6 +101,9 @@ export async function removeAccount(idOrToken: Account['id']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
|
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) => {
|
return new Promise((done, fail) => {
|
||||||
window.fetch(`${apiUrl}/i`, {
|
window.fetch(`${apiUrl}/i`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -213,7 +216,6 @@ export async function login(token: Account['token'], redirect?: string) {
|
||||||
throw reason;
|
throw reason;
|
||||||
});
|
});
|
||||||
miLocalStorage.setItem('account', JSON.stringify(me));
|
miLocalStorage.setItem('account', JSON.stringify(me));
|
||||||
document.cookie = `token=${token}; path=/; max-age=31536000`; // bull dashboardの認証とかで使う
|
|
||||||
await addAccount(me.id, token);
|
await addAccount(me.id, token);
|
||||||
|
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
|
|
Loading…
Reference in New Issue