Some cleanup
This commit is contained in:
@@ -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
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user