This commit is contained in:
parent
ba9a752250
commit
803e6da4b3
@ -21,18 +21,18 @@
|
|||||||
import MainVote from '@c/main/MainVote.vue';
|
import MainVote from '@c/main/MainVote.vue';
|
||||||
import { useUserInfoStore } from '@/stores/useUserInfoStore';
|
import { useUserInfoStore } from '@/stores/useUserInfoStore';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
import $api from '@api';
|
||||||
|
|
||||||
const userStore = useUserInfoStore();
|
const userStore = useUserInfoStore();
|
||||||
const user = ref();
|
|
||||||
const isAdmin = ref(false);
|
const isAdmin = ref(false);
|
||||||
|
|
||||||
const checkAdmin = user => {
|
const checkAdmin = async user => {
|
||||||
return user?.value?.role === 'ROLE_ADMIN' ? true : false;
|
const { data } = await $api.post('user/authCheck', { memberId: user.loginId });
|
||||||
|
return data.data === 'ROLE_ADMIN' ? true : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await userStore.userInfo();
|
await userStore.userInfo();
|
||||||
user.value = userStore.user;
|
isAdmin.value = await checkAdmin(userStore.user);
|
||||||
isAdmin.value = await checkAdmin(user);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user