url 경로 수정
This commit is contained in:
@@ -254,9 +254,11 @@ export default {
|
||||
SDLUtil.showLoadingBar(true);
|
||||
try {
|
||||
// 목록 조회 API를 호출한다.
|
||||
const { data } = await axios.get(`${SDLUtil.API_URL}/pg-board/samples`);
|
||||
const { data } = await axios.post(`${SDLUtil.API_URL}/pg-board/samples/list/main.do?method=search`, JSON.stringify({}), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// 조회 결과를 목록 상태에 저장한다.
|
||||
this.boardList = data || [];
|
||||
this.boardList = data.result || [];
|
||||
} catch (err) {
|
||||
// 오류가 발생하면 공통 에러 알림을 출력한다.
|
||||
SDLUtil.errorAlert(err);
|
||||
@@ -276,19 +278,21 @@ export default {
|
||||
SDLUtil.showLoadingBar(true);
|
||||
try {
|
||||
// 상세 조회 API를 호출한다.
|
||||
const { data } = await axios.get(`${SDLUtil.API_URL}/pg-board/samples/${id}`);
|
||||
const { data } = await axios.post(`${SDLUtil.API_URL}/pg-board/samples/item/main.do?method=getSampleBoard`, JSON.stringify({ id }), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// 조회한 데이터를 폼에 반영한다.
|
||||
this.form = {
|
||||
// 게시글 번호를 반영한다.
|
||||
id: data.id,
|
||||
id: data.result.id,
|
||||
// 제목을 반영한다.
|
||||
title: data.title,
|
||||
title: data.result.title,
|
||||
// 내용을 반영한다.
|
||||
content: data.content,
|
||||
content: data.result.content,
|
||||
// 작성자를 반영한다.
|
||||
author: data.author,
|
||||
author: data.result.author,
|
||||
// 등록일을 반영한다.
|
||||
createdAt: data.createdAt,
|
||||
createdAt: data.result.createdAt,
|
||||
};
|
||||
// 수정 모드로 전환한다.
|
||||
this.mode = 'EDIT';
|
||||
@@ -396,14 +400,18 @@ export default {
|
||||
// 수정 모드 여부를 확인한다.
|
||||
if (this.mode === 'EDIT' && this.form.id) {
|
||||
// 수정 API를 호출한다.
|
||||
const { data } = await axios.put(`${SDLUtil.API_URL}/pg-board/samples/${this.form.id}`, payload);
|
||||
const { data } = await axios.post(`${SDLUtil.API_URL}/pg-board/samples/item/main.do?method=update`, JSON.stringify({ ...payload, id: this.form.id }), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// 수정 결과를 저장한다.
|
||||
savedData = data;
|
||||
savedData = data.result;
|
||||
} else {
|
||||
// 등록 API를 호출한다.
|
||||
const { data } = await axios.post(`${SDLUtil.API_URL}/pg-board/samples`, payload);
|
||||
const { data } = await axios.post(`${SDLUtil.API_URL}/pg-board/samples/item/main.do?method=regist`, JSON.stringify(payload), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// 등록 결과를 저장한다.
|
||||
savedData = data;
|
||||
savedData = data.result;
|
||||
}
|
||||
// 저장 후 목록을 새로 조회한다.
|
||||
await this.fetchBoardList();
|
||||
@@ -461,7 +469,9 @@ export default {
|
||||
SDLUtil.showLoadingBar(true);
|
||||
try {
|
||||
// 삭제 API를 호출한다.
|
||||
await axios.delete(`${SDLUtil.API_URL}/pg-board/samples/${id}`);
|
||||
await axios.post(`${SDLUtil.API_URL}/pg-board/samples/item/main.do?method=delete`, JSON.stringify({ id }), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// 삭제 후 목록을 새로 조회한다.
|
||||
await this.fetchBoardList();
|
||||
// 삭제 후 목록 화면으로 이동한다.
|
||||
|
||||
Reference in New Issue
Block a user