diff --git a/frontend/src/stores/authStore.js b/frontend/src/stores/authStore.js index 01b345a..71dcfd9 100644 --- a/frontend/src/stores/authStore.js +++ b/frontend/src/stores/authStore.js @@ -1,5 +1,5 @@ import {defineStore} from 'pinia'; -import {computed, ref} from "vue"; +import {computed} from "vue"; import {useRouter} from "vue-router"; import {useClient} from "@/plugins/api.js"; import {useSessionStorage} from "@vueuse/core"; @@ -79,6 +79,22 @@ export const useAuthStore = defineStore( } } + async function loginWithFacebook(authResponse) { + try { + const response = await clientApi.post( + 'api/users/login-with-facebook', + { + token: authResponse.accessToken + }) + updateTokens(response.data) + return true + } catch (error) { + console.error(error) + cleanTokens() + return false + } + } + async function refresh() { try { const response = await clientApi.post( @@ -97,5 +113,14 @@ export const useAuthStore = defineStore( } } - return {accessToken, refreshToken, isAuthenticated, userId, login, loginWithGoogle, logout} + return { + accessToken, + refreshToken, + isAuthenticated, + userId, + login, + loginWithGoogle, + loginWithFacebook, + logout + } }) \ No newline at end of file diff --git a/frontend/src/stores/userProfileStore.js b/frontend/src/stores/userProfileStore.js index 6cd490d..c469f70 100644 --- a/frontend/src/stores/userProfileStore.js +++ b/frontend/src/stores/userProfileStore.js @@ -58,10 +58,6 @@ export const useUserProfileStore = defineStore( const client = useClient() const userResponse = await client.get("/api/users/profile"); value.value = userResponse.data - // Cache-busting only if portraitUrl exists - if (value.value.portraitUrl) { - value.value.portraitUrl = `${value.value.portraitUrl}?${Date.now()}`; - } } catch (error) { value.value = undefined; }