Some cleanup

This commit is contained in:
2025-02-13 15:14:32 -05:00
parent 9c716b1520
commit bf5ba51c9f
4 changed files with 8 additions and 37 deletions

View File

@@ -8,13 +8,15 @@ import {useRouter} from 'vue-router';
export const useCreatorProfileStore = defineStore(
'creator-profile',
() => {
const router = useRouter();
const authStore = useAuthStore();
watch(
() => authStore.isAuthenticated,
async (newValue) => {
if (newValue) {
await fetchCurrentCreatorProfile();
await fetchCreatorProfile();
if (value.value === undefined) {
await router.push('/');
} else {
@@ -45,7 +47,7 @@ export const useCreatorProfileStore = defineStore(
const client = useClient();
async function fetchCurrentCreatorProfile() {
async function fetchCreatorProfile() {
try {
const response = await client.get(`/api/creators/profile`);
value.value = response.data;
@@ -57,6 +59,6 @@ export const useCreatorProfileStore = defineStore(
return {
creator: value,
hasCreator,
fetchCurrentCreatorProfile
fetchCreatorProfile
};
});