Skip to content

Commit 649f1b3

Browse files
authored
Merge pull request #62 from chaechae128/depoly-dev
[FEATURE] 재학습연동 수정
2 parents e8b6b7f + 0e9713f commit 649f1b3

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

front/fe-rw/src/pages/admin/AdminAIPage.jsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useState, useEffect } from "react";
22
import AdminSidebar from "../../components/admin/AdminSidebar";
33
import {ADMIN_AI_API} from "../../constants/api";
4+
import axios from "axios";
5+
46
const AdminAIPage = () => {
57
// 상태 관리
68
const [loading, setLoading] = useState(true);
@@ -10,33 +12,39 @@ const AdminAIPage = () => {
1012
const [retraining, setRetraining] = useState(false);
1113

1214
// 재학습 함수
13-
const handleRetrain = async () => {
15+
const handleRetrain = async () => {
1416
setRetraining(true);
1517
try {
1618
console.log("재학습 요청 시작...");
17-
18-
const response = await post(ADMIN_AI_API.RETRAINING, {
19-
method: "POST",
20-
headers: {
21-
"Content-Type": "application/json",
22-
},
23-
});
2419

25-
const result = await response.json();
20+
const response = await axios.post(
21+
ADMIN_AI_API.RETRAINING,
22+
{}, // POST body 비어 있으면 빈 객체
23+
{
24+
headers: {
25+
"Content-Type": "application/json",
26+
},
27+
}
28+
);
29+
30+
const result = response.data;
2631

27-
if (response.ok && result.success) {
32+
if (result.success) {
2833
alert(result.data || "재학습이 완료되었습니다!");
2934
window.location.reload();
3035
} else {
3136
alert(result.error?.message || "재학습에 실패했습니다.");
3237
}
3338
} catch (error) {
3439
console.error("재학습 중 오류 발생:", error);
35-
alert("재학습 중 오류가 발생했습니다: " + error.message);
40+
const message =
41+
error.response?.data?.error?.message || error.message || "알 수 없는 오류";
42+
alert("재학습 중 오류가 발생했습니다: " + message);
3643
} finally {
3744
setRetraining(false);
3845
}
3946
};
47+
4048
// 영어 카테고리명을 한국어로 변환 (얼룩 모델용)
4149
const getCategoryKoreanName = (englishName) => {
4250
const nameMap = {

0 commit comments

Comments
 (0)