Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit d3dcb59

Browse files
authored
feat: set cookies' expires attribute and fix remember me (#530)
Former-commit-id: b5987f2
1 parent 0cbe516 commit d3dcb59

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frontend/composables/use-auth-context.ts

+10
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ class AuthContext implements IAuthContext {
114114
const r = await api.login(email, password, stayLoggedIn);
115115

116116
if (!r.error) {
117+
const expiresAt = new Date(r.data.expiresAt);
118+
this._token = useCookie(AuthContext.cookieTokenKey, {
119+
expires: expiresAt,
120+
});
121+
this._expiresAt = useCookie(AuthContext.cookieExpiresAtKey, {
122+
expires: expiresAt,
123+
});
124+
this._attachmentToken = useCookie(AuthContext.cookieAttachmentTokenKey, {
125+
expires: expiresAt,
126+
});
117127
this._token.value = r.data.token;
118128
this._expiresAt.value = r.data.expiresAt as string;
119129
this._attachmentToken.value = r.data.attachmentToken;

0 commit comments

Comments
 (0)