Skip to content

Commit 0d3b0f2

Browse files
authored
Merge pull request #5 from TeamProject-Daewoo/local_main
Local main
2 parents 69d43ca + ec49f80 commit 0d3b0f2

7 files changed

Lines changed: 25 additions & 15 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<link rel="icon" href="/favicon.ico">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>HotelHub 관리자</title></title>
7+
<title>HotelHub 관리자</title>
88
</head>
99
<body>
1010
<div id="app"></div>

public/favicon.ico

-3.06 KB
Binary file not shown.

src/api/axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useRouter } from 'vue-router'; // useRouter 임포트
66
const router = useRouter(); // router 인스턴스 생성
77

88
const api = axios.create({
9-
baseURL: '/admin',
9+
baseURL: import.meta.env.VITE_BACK_ADMIN_URL,
1010
headers: { 'Content-Type': 'application/json' },
1111
withCredentials: true, // refreshToken 쿠키 전송
1212
})

src/components/AdminNotice/AdminNoticeCreate.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
<script setup>
4141
import { reactive, ref } from "vue";
4242
import axios from "@/api/axios";
43+
import { useRouter } from 'vue-router';
44+
45+
const router = useRouter();
4346
4447
const form = reactive({
4548
category: "",
@@ -68,7 +71,9 @@ const submitNotice = async () => {
6871
title: form.title,
6972
content: form.content,
7073
});
71-
message.value = "공지사항이 성공적으로 등록되었습니다.";
74+
alert("공지사항이 성공적으로 등록되었습니다.");
75+
router.push('/admin/notices');
76+
7277
isError.value = false;
7378
7479
// 초기화

src/components/AdminNotice/NoticeDetail.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,18 @@ const cancelEdit = () => {
9191
};
9292
9393
const saveEdit = async () => {
94+
// 1. 제목과 내용이 비어있는지 먼저 확인합니다.
9495
if (!editTitle.value.trim() || !editContent.value.trim()) {
9596
message.value = '제목과 내용을 모두 입력해주세요.';
9697
isError.value = true;
9798
return;
9899
}
99100
101+
// 2. 사용자에게 수정 여부를 물어보고 확인합니다.
102+
if (!confirm('수정하시겠습니까?')) {
103+
return; // 사용자가 '취소'를 누르면 여기서 함수를 종료합니다.
104+
}
105+
100106
loading.value = true;
101107
message.value = '';
102108
isError.value = false;
@@ -106,19 +112,15 @@ const saveEdit = async () => {
106112
await api.put(`/api/admin/notices/${id}`, {
107113
title: editTitle.value,
108114
content: editContent.value,
109-
category: notice.value.category, // 기존 카테고리 유지
115+
category: notice.value.category,
110116
});
111117
112-
// 수정 완료 후 데이터 업데이트
113-
notice.value.title = editTitle.value;
114-
notice.value.content = editContent.value;
118+
// 3. 수정 성공 시 alert 알림을 띄웁니다.
119+
alert('공지사항이 성공적으로 수정되었습니다.');
115120
116-
isEditing.value = false;
117-
message.value = '공지사항이 성공적으로 수정되었습니다.';
118-
isError.value = false;
119-
120-
// 수정 완료 후 목록 페이지로 이동
121+
// 4. 사용자가 alert의 '확인'을 누르면 목록 페이지로 이동합니다.
121122
router.push('/admin/notices');
123+
122124
} catch (error) {
123125
console.error('공지 수정 실패:', error);
124126
if (error.response && error.response.status === 403) {

src/components/AdminNotice/notice.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ const fetchNoticesPaged = async (page = 0) => {
107107
108108
const deleteNotice = async (id) => {
109109
try {
110+
if (!confirm('삭제하시겠습니까?')) {
111+
return; // 사용자가 '취소'를 누르면 여기서 함수를 종료합니다.
112+
}
110113
await notice.delete(`/api/admin/notices/${id}`);
111114
// 삭제 성공 후 리스트 새로고침
112115
fetchNoticesPaged(currentPage.value);
116+
alert('게시글이 삭제되었습니다');
113117
} catch (error) {
114118
console.error('삭제 실패:', error);
115119
alert('삭제 중 오류가 발생했습니다.');

src/router/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ const router = createRouter({
2929
{ path: '/admin/approvelist', name: 'ApproveList', component: ApproveList , meta: { requiresAuth: true, requiredRoles: ['ROLE_ADMIN_SUPER','ROLE_ADMIN_BIZ'] } },
3030
{ path: '/admin/reviews', name: 'Review', component: ReviewList, meta: { requiresAuth: true, requiredRoles: ['ROLE_ADMIN_SUPER', 'ROLE_ADMIN_CS'] }},
3131
{ path: '/errorPage', name: 'errorPage', component: errorPage, meta: { layout: 'EmptyLayout' } },
32-
{path: '/admin/coupons',name: 'AdminCoupons',component: () => import('@/components/coupon/AdminCouponList.vue'),meta: { requiresAuth: true }},
33-
{path: '/admin/coupons/new',name: 'AdminCouponNew',component: () => import('@/components/coupon/AdminCouponForm.vue'),meta: { requiresAuth: true }},
34-
{ path: '/admin/approvelist', name: 'ApproveList', component: ApproveList , meta: { requiresAuth: true } },
32+
{path: '/admin/coupons',name: 'AdminCoupons',component: () => import('@/components/coupon/AdminCouponList.vue'),meta: { requiresAuth: true, requiredRoles: ['ROLE_ADMIN_SUPER', 'ROLE_ADMIN_BIZ'] }},
33+
{path: '/admin/coupons/new',name: 'AdminCouponNew',component: () => import('@/components/coupon/AdminCouponForm.vue'),meta: { requiresAuth: true, requiredRoles: ['ROLE_ADMIN_SUPER', 'ROLE_ADMIN_BIZ'] }},
3534

3635
{
3736
path: '/admin/account',

0 commit comments

Comments
 (0)