에러페이지 수정

This commit is contained in:
dyhj625 2025-03-18 12:23:23 +09:00
parent adbc5d0383
commit 00acd58995
9 changed files with 149 additions and 192 deletions

View File

@ -79,9 +79,10 @@ $api.interceptors.response.use(
} }
// 에러 응답에 커스텀 메시지가 포함되어 있다면 해당 메시지 사용 // 에러 응답에 커스텀 메시지가 포함되어 있다면 해당 메시지 사용
if (error.response && error.response.data && error.response.data.message) { // if (error.response && error.response.data && error.response.data.message) {
toastStore.onToast(error.response.data.message, 'e'); // toastStore.onToast(error.response.data.message, 'e');
} else if (error.response) { // } else if (error.response) {
if (error.response) {
// 기본 HTTP 에러 처리 // 기본 HTTP 에러 처리
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:

View File

@ -48,7 +48,6 @@ const fetchSentVacationCount = async () => {
availableQuota.value = Math.max(maxQuota - sentCount.value, 0); availableQuota.value = Math.max(maxQuota - sentCount.value, 0);
grantCount.value = availableQuota.value; grantCount.value = availableQuota.value;
} catch (error) { } catch (error) {
console.error("🚨 연차 전송 기록 조회 실패:", error);
availableQuota.value = maxQuota; availableQuota.value = maxQuota;
grantCount.value = maxQuota; grantCount.value = maxQuota;
} }

View File

@ -95,11 +95,11 @@ const routes = [
component: () => import('@v/admin/TheAuthorization.vue'), component: () => import('@v/admin/TheAuthorization.vue'),
meta: { requiresAuth: true } meta: { requiresAuth: true }
}, },
{ path: "/error/400", name: "Error400", component: () => import('@v/error/Error400.vue') }, { path: "/error/400", name: "Error400", component: () => import('@v/error/Error400.vue'), meta: {layout: 'NoLayout'} },
{ path: "/error/500", name: "Error500", component: () => import('@v/error/Error500.vue') }, { path: "/error/500", name: "Error500", component: () => import('@v/error/Error500.vue'), meta: {layout: 'NoLayout'} },
{ {
path: "/:anything(.*)", path: "/:anything(.*)",
name: "Error404", component: () => import('@v/error/Error404.vue') name: "Error404", component: () => import('@v/error/Error404.vue'), meta: {layout: 'NoLayout'}
}, },
]; ];

View File

@ -52,7 +52,6 @@ async function fetchUsers() {
isAdmin: user.MEMBERROL === 'ROLE_ADMIN', isAdmin: user.MEMBERROL === 'ROLE_ADMIN',
})); }));
} catch (error) { } catch (error) {
console.error('사용자 목록을 불러오는 중 오류 발생:', error);
toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e'); toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e');
} }
} }
@ -83,7 +82,6 @@ async function toggleAdmin(user) {
throw new Error('권한 변경 실패'); throw new Error('권한 변경 실패');
} }
} catch (error) { } catch (error) {
console.error('권한 변경 중 오류 발생:', error);
toastStore.onToast('권한 변경에 실패했습니다.', 'e'); toastStore.onToast('권한 변경에 실패했습니다.', 'e');
} }
} }

View File

@ -182,74 +182,66 @@ const handleSizeChange = () => {
// //
const fetchGeneralPosts = async (page = 1) => { const fetchGeneralPosts = async (page = 1) => {
try { const { data } = await axios.get("board/general", {
const { data } = await axios.get("board/general", { params: {
params: { page,
page, size: selectedSize.value,
size: selectedSize.value, orderBy: selectedOrder.value,
orderBy: selectedOrder.value, searchKeyword: searchText.value
searchKeyword: searchText.value
}
});
if (data?.data) {
const totalPosts = data.data.total;
generalList.value = data.data.list.map((post, index) => ({
realId: post.id,
id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title,
author: post.author || '익명',
rawDate: post.date,
date: formatDate(post.date), //
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
pagination.value = {
...pagination.value,
currentPage: data.data.pageNum,
pages: data.data.pages,
prePage: data.data.prePage,
nextPage: data.data.nextPage,
isFirstPage: data.data.isFirstPage,
isLastPage: data.data.isLastPage,
hasPreviousPage: data.data.hasPreviousPage,
hasNextPage: data.data.hasNextPage,
navigatePages: data.data.navigatePages,
navigatepageNums: data.data.navigatepageNums,
navigateFirstPage: data.data.navigateFirstPage,
navigateLastPage: data.data.navigateLastPage
};
} }
} catch (error) { });
console.error("데이터 오류:", error);
if (data?.data) {
const totalPosts = data.data.total;
generalList.value = data.data.list.map((post, index) => ({
realId: post.id,
id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title,
author: post.author || '익명',
rawDate: post.date,
date: formatDate(post.date), //
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
pagination.value = {
...pagination.value,
currentPage: data.data.pageNum,
pages: data.data.pages,
prePage: data.data.prePage,
nextPage: data.data.nextPage,
isFirstPage: data.data.isFirstPage,
isLastPage: data.data.isLastPage,
hasPreviousPage: data.data.hasPreviousPage,
hasNextPage: data.data.hasNextPage,
navigatePages: data.data.navigatePages,
navigatepageNums: data.data.navigatepageNums,
navigateFirstPage: data.data.navigateFirstPage,
navigateLastPage: data.data.navigateLastPage
};
} }
}; };
// //
const fetchNoticePosts = async () => { const fetchNoticePosts = async () => {
try { const { data } = await axios.get("board/notices", {
const { data } = await axios.get("board/notices", { params: { searchKeyword: searchText.value }
params: { searchKeyword: searchText.value } });
});
if (data?.data) { if (data?.data) {
noticeList.value = data.data.map(post => ({ noticeList.value = data.data.map(post => ({
id: post.id, id: post.id,
title: post.title, title: post.title,
author: post.author || '관리자', author: post.author || '관리자',
date: formatDate(post.date), date: formatDate(post.date),
rawDate: post.date, rawDate: post.date,
views: post.cnt || 0, views: post.cnt || 0,
hasAttachment: post.hasAttachment, hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null, img: post.firstImageUrl || null,
commentCount : post.commentCount commentCount : post.commentCount
})); }));
}
} catch (error) {
console.error("데이터 오류:", error);
} }
}; };

View File

@ -206,7 +206,6 @@
link.remove(); link.remove();
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
} catch (error) { } catch (error) {
console.error('파일 다운로드 오류:', error);
alert('파일 다운로드 중 오류가 발생했습니다.'); alert('파일 다운로드 중 오류가 발생했습니다.');
} }
}; };
@ -272,25 +271,21 @@
// , // ,
const handleUpdateReaction = async ({ boardId, commentId, isLike, isDislike }) => { const handleUpdateReaction = async ({ boardId, commentId, isLike, isDislike }) => {
try { await axios.post(`/board/${boardId}/${commentId}/reaction`, {
await axios.post(`/board/${boardId}/${commentId}/reaction`, { LOCBRDSEQ: boardId, // id
LOCBRDSEQ: boardId, // id LOCCMTSEQ: commentId, // id
LOCCMTSEQ: commentId, // id LOCGOBGOD: isLike ? 'T' : 'F',
LOCGOBGOD: isLike ? 'T' : 'F', LOCGOBBAD: isDislike ? 'T' : 'F',
LOCGOBBAD: isDislike ? 'T' : 'F', });
});
const response = await axios.get(`board/${boardId}`); const response = await axios.get(`board/${boardId}`);
const updatedData = response.data.data; const updatedData = response.data.data;
likes.value = updatedData.likeCount; likes.value = updatedData.likeCount;
dislikes.value = updatedData.dislikeCount; dislikes.value = updatedData.dislikeCount;
likeClicked.value = isLike; likeClicked.value = isLike;
dislikeClicked.value = isDislike; dislikeClicked.value = isDislike;
} catch (error) {
alert('오류가 발생했습니다.');
}
}; };
// //
@ -411,24 +406,20 @@
return; return;
} }
try { const response = await axios.post(`board/${currentBoardId.value}/comment`, {
const response = await axios.post(`board/${currentBoardId.value}/comment`, { LOCBRDSEQ: currentBoardId.value,
LOCBRDSEQ: currentBoardId.value, LOCCMTRPY: comment,
LOCCMTRPY: comment, LOCCMTPWD: isCheck ? password : '',
LOCCMTPWD: isCheck ? password : '', LOCCMTPNT: 1,
LOCCMTPNT: 1, LOCBRDTYP: isCheck ? '300102' : null,
LOCBRDTYP: isCheck ? '300102' : null, });
});
if (response.status === 200) { if (response.status === 200) {
passwordAlert.value = ''; passwordAlert.value = '';
commentAlert.value = ''; commentAlert.value = '';
await fetchComments(); await fetchComments();
} else { } else {
alert('댓글 작성을 실패했습니다.'); alert('댓글 작성을 실패했습니다.');
}
} catch (error) {
alert('오류가 발생했습니다.');
} }
}; };

View File

@ -129,15 +129,11 @@
const fileError = ref(''); const fileError = ref('');
const fetchCategories = async () => { const fetchCategories = async () => {
try { const response = await axios.get('board/categories');
const response = await axios.get('board/categories'); categoryList.value = response.data.data;
categoryList.value = response.data.data; const freeCategory = categoryList.value.find(category => category.CMNCODNAM === '자유');
const freeCategory = categoryList.value.find(category => category.CMNCODNAM === '자유'); if (freeCategory) {
if (freeCategory) { categoryValue.value = freeCategory.CMNCODVAL;
categoryValue.value = freeCategory.CMNCODVAL;
}
} catch (error) {
console.error('카테고리 불러오기 오류:', error);
} }
}; };
@ -243,7 +239,6 @@
toastStore.onToast('게시물이 작성되었습니다.', 's'); toastStore.onToast('게시물이 작성되었습니다.', 's');
goList(); goList();
} catch (error) { } catch (error) {
console.error(error);
toastStore.onToast('게시물 작성 중 오류가 발생했습니다.', 'e'); toastStore.onToast('게시물 작성 중 오류가 발생했습니다.', 'e');
} }
}; };

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="error-container"> <div class="error-page">
<div class="error-content"> <div class="error-content">
<img src="/img/illustrations/page-misc-error-dark.png" alt="Error Illustration" class="error-image" /> <img src="/img/illustrations/page-misc-error-dark.png" alt="Error Illustration" class="error-image" />
<h1>400</h1> <h1>400</h1>

View File

@ -264,25 +264,21 @@ async function loadCalendarData(year, month) {
/* 프로필 구역 */ /* 프로필 구역 */
// //
const handleProfileClick = async (user) => { const handleProfileClick = async (user) => {
try { if (isModalOpen.value && user.MEMBERSEQ === userStore.user.id) {
if (isModalOpen.value && user.MEMBERSEQ === userStore.user.id) { return;
return; }
} if (isGrantModalOpen.value && selectedUser.value?.MEMBERSEQ === user.MEMBERSEQ) {
if (isGrantModalOpen.value && selectedUser.value?.MEMBERSEQ === user.MEMBERSEQ) { return;
return; }
} isModalOpen.value = false;
isModalOpen.value = false; isGrantModalOpen.value = false;
isGrantModalOpen.value = false; if (user.MEMBERSEQ === userStore.user.id) {
if (user.MEMBERSEQ === userStore.user.id) { const displayedYear = lastRemainingYear.value;
const displayedYear = lastRemainingYear.value; await fetchVacationHistory(displayedYear);
await fetchVacationHistory(displayedYear); isModalOpen.value = true;
isModalOpen.value = true; } else {
} else { selectedUser.value = user;
selectedUser.value = user; isGrantModalOpen.value = true;
isGrantModalOpen.value = true;
}
} catch (error) {
console.error("🚨 연차 데이터 불러오기 실패:", error);
} }
}; };
// //
@ -309,16 +305,12 @@ const fetchUserList = async () => {
}; };
// //
const fetchRemainingVacation = async () => { const fetchRemainingVacation = async () => {
try { const response = await axios.get("vacation/remaining");
const response = await axios.get("vacation/remaining"); if (response.status === 200) {
if (response.status === 200) { remainingVacationData.value = response.data.data.reduce((acc, vacation) => {
remainingVacationData.value = response.data.data.reduce((acc, vacation) => { acc[vacation.employeeId] = vacation.remainingQuota;
acc[vacation.employeeId] = vacation.remainingQuota; return acc;
return acc; }, {});
}, {});
}
} catch (error) {
console.error("🚨 남은 연차 데이터를 불러오지 못했습니다:", error);
} }
}; };
// //
@ -405,55 +397,48 @@ async function saveVacationChanges() {
const currentDate = fullCalendarRef.value.getApi().getDate(); const currentDate = fullCalendarRef.value.getApi().getDate();
await loadCalendarData(currentDate.getFullYear(), currentDate.getMonth() + 1); await loadCalendarData(currentDate.getFullYear(), currentDate.getMonth() + 1);
} catch (error) { } catch (error) {
console.error("🚨 휴가 변경 저장 실패:", error);
toastStore.onToast('휴가 저장 요청에 실패했습니다.', 'e'); toastStore.onToast('휴가 저장 요청에 실패했습니다.', 'e');
} }
} }
/* 휴가 조회 */ /* 휴가 조회 */
// //
async function fetchVacationHistory(year) { async function fetchVacationHistory(year) {
try { const response = await axios.get(`vacation/history?year=${year}`);
const response = await axios.get(`vacation/history?year=${year}`); if (response.status === 200 && response.data) {
if (response.status === 200 && response.data) { myVacations.value = response.data.data.usedVacations || [];
myVacations.value = response.data.data.usedVacations || []; receivedVacations.value = response.data.data.receivedVacations || []
receivedVacations.value = response.data.data.receivedVacations || []
}
} catch (error) {
console.error(`🚨 휴가 데이터 불러오기 실패:`, error);
} }
} }
// //
async function fetchVacationData(year, month) { async function fetchVacationData(year, month) {
try {
const response = await axios.get(`vacation/list/${year}/${month}`); const response = await axios.get(`vacation/list/${year}/${month}`);
if (response.status === 200) { if (response.status === 200) {
const vacationList = response.data; const vacationList = response.data;
// //
const filteredVacations = vacationList.filter(vac => const filteredVacations = vacationList.filter(vac =>
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM
); );
const events = filteredVacations.map(vac => { const events = filteredVacations.map(vac => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : ""; let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
let backgroundColor = userColors.value[vac.MEMBERSEQ]; let backgroundColor = userColors.value[vac.MEMBERSEQ];
return { return {
title: getVacationType(vac.LOCVACTYP), title: getVacationType(vac.LOCVACTYP),
start: dateStr, start: dateStr,
backgroundColor, backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)], classNames: [getVacationTypeClass(vac.LOCVACTYP)],
saved: true, saved: true,
memberSeq: vac.MEMBERSEQ, memberSeq: vac.MEMBERSEQ,
}; };
}).filter(event => event.start); }).filter(event => event.start);
return events; return events;
} else { } else {
console.warn("📌 휴가 데이터를 불러오지 못함"); console.warn("📌 휴가 데이터를 불러오지 못함");
return [];
}
} catch (error) {
console.error("Error fetching vacation data:", error);
return []; return [];
} }
return [];
} }
// //
function updateCalendarEvents() { function updateCalendarEvents() {
const selectedEvents = Array.from(selectedDates.value) const selectedEvents = Array.from(selectedDates.value)
@ -514,18 +499,14 @@ const getVacationTypeClass = (type) => {
}; };
// //
const fetchVacationCodes = async () => { const fetchVacationCodes = async () => {
try { const response = await axios.get("vacation/codes");
const response = await axios.get("vacation/codes"); if (response.status === 200 && response.data) {
if (response.status === 200 && response.data) { vacationCodeMap.value = response.data.data.reduce((acc, item) => {
vacationCodeMap.value = response.data.data.reduce((acc, item) => { acc[item.code] = item.name;
acc[item.code] = item.name; return acc;
return acc; }, {});
}, {}); } else {
} else { console.warn("❌ 공통 코드 데이터를 불러오지 못했습니다.");
console.warn("❌ 공통 코드 데이터를 불러오지 못했습니다.");
}
} catch (error) {
console.error("🚨 공통 코드 API 호출 실패:", error);
} }
}; };
const getVacationType = (typeCode) => { const getVacationType = (typeCode) => {