Skip to content

Commit

Permalink
feat: set cookies' expires attribute and fix remember me (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
gucheen committed Aug 10, 2023
1 parent 2cbcc8b commit b5987f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/composables/use-auth-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b5987f2

Please sign in to comment.