21 lines
490 B
JavaScript
21 lines
490 B
JavaScript
import { ref } from "vue";
|
|
import $api from "@api";
|
|
|
|
//메뉴 구성 시 롤 체크용
|
|
//mounted 에서 fetchRole 해줘야댐
|
|
export function useAuthRole() {
|
|
const role = ref(null);
|
|
const error = ref(null);
|
|
|
|
const fetchRole = async () => {
|
|
try {
|
|
const response = await $api.get("/user/roleCheck");
|
|
role.value = response.data.data;
|
|
} catch (err) {
|
|
error.value = err;
|
|
}
|
|
};
|
|
|
|
return { role, error, fetchRole };
|
|
}
|