mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-22 06:46:32 +00:00
feat: set cookies' expires attribute and fix remember me (#530)
Former-commit-id: b5987f2e8d
This commit is contained in:
parent
0cbe516ca3
commit
d3dcb599ca
1 changed files with 10 additions and 0 deletions
|
@ -114,6 +114,16 @@ class AuthContext implements IAuthContext {
|
|||
const r = await api.login(email, password, stayLoggedIn);
|
||||
|
||||
if (!r.error) {
|
||||
const expiresAt = new Date(r.data.expiresAt);
|
||||
this._token = useCookie(AuthContext.cookieTokenKey, {
|
||||
expires: expiresAt,
|
||||
});
|
||||
this._expiresAt = useCookie(AuthContext.cookieExpiresAtKey, {
|
||||
expires: expiresAt,
|
||||
});
|
||||
this._attachmentToken = useCookie(AuthContext.cookieAttachmentTokenKey, {
|
||||
expires: expiresAt,
|
||||
});
|
||||
this._token.value = r.data.token;
|
||||
this._expiresAt.value = r.data.expiresAt as string;
|
||||
this._attachmentToken.value = r.data.attachmentToken;
|
||||
|
|
Loading…
Reference in a new issue