diff --git a/src/stores/authStore.js b/src/stores/authStore.js index 11a09d7..f129a0b 100644 --- a/src/stores/authStore.js +++ b/src/stores/authStore.js @@ -9,8 +9,10 @@ export const useAuthStore = defineStore( () => { const clientApi = useClient() const router = useRouter() + const accessToken = useSessionStorage('auth-accessToken', undefined) const refreshToken = useSessionStorage('auth-refreshToken', undefined) + const isAuthenticated = computed(() => !!accessToken.value) function updateTokens(data) { @@ -25,9 +27,9 @@ export const useAuthStore = defineStore( }) } - function logout() { + async function logout() { cleanTokens() - router.push('/') + await router.push('/') } async function login(email, password) { diff --git a/src/stores/userStore.js b/src/stores/userStore.js index ed038b0..e9af8db 100644 --- a/src/stores/userStore.js +++ b/src/stores/userStore.js @@ -10,7 +10,7 @@ export const useUserStore = defineStore( const authStore = useAuthStore() const authWatcher = watch( () => authStore.isAuthenticated, - async (newValue, oldValue) => { + async (newValue) => { if (newValue) { await fetchCurrentUserProfile() } else { diff --git a/src/views/contents/ContentList.vue b/src/views/contents/ContentList.vue index ba81811..95b163d 100644 --- a/src/views/contents/ContentList.vue +++ b/src/views/contents/ContentList.vue @@ -45,16 +45,15 @@ const creatorIdWatcher = watch( (newCreatorId) => { if (newCreatorId) { // Reset contents and last_id when the creatorId changes - contents.value = []; - last_id = null; + contents.value = [] + last_id = null // Fetch contents for the new creator fetchContents({ done: () => { } }); } - }, - {immediate: true}) + }) async function fetchContents({done}) { try { diff --git a/src/views/contents/CreatePostButton.vue b/src/views/contents/PublishContentButton.vue similarity index 97% rename from src/views/contents/CreatePostButton.vue rename to src/views/contents/PublishContentButton.vue index 970673f..fc737b2 100644 --- a/src/views/contents/CreatePostButton.vue +++ b/src/views/contents/PublishContentButton.vue @@ -61,7 +61,7 @@ const closeDialog = () => { mdi-text-box-plus-outline diff --git a/src/views/creators/CreatorBanner.vue b/src/views/creators/CreatorBanner.vue index 9b709ba..9984e79 100644 --- a/src/views/creators/CreatorBanner.vue +++ b/src/views/creators/CreatorBanner.vue @@ -59,7 +59,7 @@ {{ creator.occupation }} - {{creator.subscriberCount}} Abonnés + {{ creator.subscriberCount }} Abonnés @@ -69,7 +69,7 @@ - + @@ -79,10 +79,10 @@
{{ creator.occupation }}