mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-22 08:35:43 +00:00
feat: set cookies' expires attribute and fix remember me (#530)
This commit is contained in:
parent
2cbcc8bb1d
commit
b5987f2e8d
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);
|
const r = await api.login(email, password, stayLoggedIn);
|
||||||
|
|
||||||
if (!r.error) {
|
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._token.value = r.data.token;
|
||||||
this._expiresAt.value = r.data.expiresAt as string;
|
this._expiresAt.value = r.data.expiresAt as string;
|
||||||
this._attachmentToken.value = r.data.attachmentToken;
|
this._attachmentToken.value = r.data.attachmentToken;
|
||||||
|
|
Loading…
Reference in a new issue