diff --git a/jsconfig.json b/jsconfig.json index e077a92..6b1facb 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -10,6 +10,7 @@ "@l/*": ["src/layout/*"], "@s/*": ["src/stores/*"], "@p/*": ["src/common/plugin/*"], + "@api": ["./src/common/axios-interceptor.js"] } }, "exclude": ["node_modules", "dist"] diff --git a/src/components/editor/QEditor.vue b/src/components/editor/QEditor.vue index 405f621..c2776cf 100644 --- a/src/components/editor/QEditor.vue +++ b/src/components/editor/QEditor.vue @@ -53,7 +53,7 @@ import Quill from 'quill'; import 'quill/dist/quill.snow.css'; import { onMounted, ref, watch, defineEmits } from 'vue'; -import $api from '@/common/axios-interceptor'; +import $api from '@api'; const editor = ref(null); const font = ref('nanum-gothic'); diff --git a/src/composable/useAuthRole.js b/src/composable/useAuthRole.js new file mode 100644 index 0000000..0c27035 --- /dev/null +++ b/src/composable/useAuthRole.js @@ -0,0 +1,20 @@ +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 }; +} diff --git a/vite.config.js b/vite.config.js index 128e399..617eec4 100644 --- a/vite.config.js +++ b/vite.config.js @@ -18,6 +18,7 @@ export default defineConfig({ '@l': fileURLToPath(new URL('./src/layout/', import.meta.url)), '@s': fileURLToPath(new URL('./src/stores/', import.meta.url)), '@p': fileURLToPath(new URL('./src/common/plugin/', import.meta.url)), + "@api": fileURLToPath(new URL('./src/common/axios-interceptor.js', import.meta.url)) }, }, })