Skip to content

Commit

Permalink
hotfix(FE): 학습로그 삭제시 라우트 및 성공 메세지가 노출되지 않는 이슈 해결 (#696)
Browse files Browse the repository at this point in the history
* fix: 학습로그 삭제 성공시 학습로그 목록으로 이동로직 추가

* feat: 삭제 성공시 성공 안내 메세지 추가
  • Loading branch information
sunhpark42 authored Feb 27, 2022
1 parent d410c44 commit 72ded70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/src/constants/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const ERROR_MESSAGE = {

const SUCCESS_MESSAGE = {
CREATE_POST: '글이 작성되었습니다.',
DELETE_STUDYLOG: '글이 삭제되었습니다.',
CREATE_ABILITY: '역량을 추가했습니다.',
EDIT_ABILITY: '역량을 수정했습니다.',
DELETE_ABILITY: '역량을 삭제했습니다.',
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/StudylogPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
PATH,
SNACKBAR_MESSAGE,
} from '../../constants';
import { SUCCESS_MESSAGE } from '../../constants/message';

const StudylogPage = () => {
const { id } = useParams();
Expand All @@ -49,6 +50,10 @@ const StudylogPage = () => {
return requestDeleteStudylog({ id, accessToken });
},
{
onSuccess: () => {
openSnackBar(SUCCESS_MESSAGE.DELETE_STUDYLOG);
history.push(PATH.STUDYLOG);
},
onError: (error) => {
alert(ERROR_MESSAGE[error.code] ?? ALERT_MESSAGE.FAIL_TO_DELETE_STUDYLOG);
},
Expand Down

0 comments on commit 72ded70

Please sign in to comment.