Linked frontend to backend

This commit is contained in:
Kamigen
2024-04-22 16:38:17 -04:00
parent ec32a525a9
commit 4a74ca99b7
2 changed files with 17 additions and 3 deletions

View File

@@ -42,6 +42,18 @@ export const auth = defineStore({
this.startRefreshTokenTimer();
},
async loginGoogle(client, accessToken) {
const response = await client.post(`${baseUrl}/google`, {accessToken: accessToken})
this.user = {
accessToken: response.data.accessToken,
refreshToken: response.data.refreshToken,
email: response.data.email
}
localStorage.setItem('jwt', this.user.accessToken);
this.startRefreshTokenTimer();
},
logout() {
localStorage.setItem('jwt', '');
this.user = null;