diff --git a/src/common/axios-interceptor.js b/src/common/axios-interceptor.js
index 16894c5..2068cb7 100644
--- a/src/common/axios-interceptor.js
+++ b/src/common/axios-interceptor.js
@@ -1,7 +1,7 @@
import axios from 'axios';
-import { useRoute } from 'vue-router';
+import router from '@/router';
import { useToastStore } from '@s/toastStore';
-import { useLoadingStore } from "@s/loadingStore";
+import { useLoadingStore } from '@s/loadingStore';
const $api = axios.create({
baseURL: import.meta.env.VITE_API_URL,
@@ -46,8 +46,8 @@ $api.interceptors.response.use(
function (error) {
const loadingStore = useLoadingStore();
loadingStore.stopLoading();
-
const toastStore = useToastStore();
+
// 오류 응답 처리
if (error.response) {
switch (error.response.status) {
@@ -55,6 +55,7 @@ $api.interceptors.response.use(
if (!error.config.headers.isLogin) {
// toastStore.onToast('인증이 필요합니다.', 'e');
}
+ router.push('/login');
break;
case 403:
toastStore.onToast('접근 권한이 없습니다.', 'e');
diff --git a/src/common/common.js b/src/common/common.js
index a93e8a8..5bf3125 100644
--- a/src/common/common.js
+++ b/src/common/common.js
@@ -1,18 +1,20 @@
/*
작성자 : 공현지
작성일 : 2025-01-17
- 수정자 :
- 수정일 :
+ 수정자 : 박성용
+ 수정일 : 2025-03-11
설명 : 공통 스크립트
*/
import Quill from 'quill';
/*
- *템플릿 사용법 : $common.변수
- *setup() 사용법 :
- const { appContext } = getCurrentInstance();
- const $common = appContext.config.globalProperties.$common;
- $common.변수
+ *템플릿 사용법 : $common.변수
+ *setup() 사용법 :
+ const { appContext } = getCurrentInstance();
+ const $common = appContext.config.globalProperties.$common;
+ or
+ import { inject } from 'vue';
+ const $common = inject('common');
*/
const common = {
// JSON 문자열로 Delta 타입을 변환
@@ -74,6 +76,12 @@ const common = {
};
},
+ /**
+ * 빈값 확인
+ *
+ * @param {} obj
+ * @returns
+ */
isNotEmpty(obj) {
if (obj === null || obj === undefined) return false;
if (typeof obj === 'string' && obj.trim() === '') return false;
@@ -103,12 +111,25 @@ const common = {
/**
* 빈 값 확인
*
- * @param {ref} text ex) inNotValidInput(data.value);
+ * @param { ref } text ex) inNotValidInput(data.value);
* @returns
*/
isNotValidInput(text) {
return text.trim().length === 0;
},
+
+ /**
+ * 프로필 이미지 반환
+ *
+ * @param { String } profileImg
+ * @returns
+ */
+ getProfileImage(profileImg) {
+ let profileImgUrl = '/img/icons/icon.png'; // 기본 프로필 이미지 경로
+ const UserProfile = `${import.meta.env.VITE_SERVER}upload/img/profile/${profileImg}`;
+
+ return !profileImg || profileImg === '' ? profileImgUrl : UserProfile;
+ },
};
export default {
diff --git a/src/components/board/BoardProfile.vue b/src/components/board/BoardProfile.vue
index 5510843..f86ec1c 100644
--- a/src/components/board/BoardProfile.vue
+++ b/src/components/board/BoardProfile.vue
@@ -31,17 +31,11 @@
diff --git a/src/components/vacation/ProfileList.vue b/src/components/vacation/ProfileList.vue
index 5ad55f7..2c79ea9 100644
--- a/src/components/vacation/ProfileList.vue
+++ b/src/components/vacation/ProfileList.vue
@@ -1,6 +1,6 @@