Skip to content

Commit

Permalink
글 수정 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaeyeon1 committed Nov 30, 2023
1 parent 7bba1b5 commit 20e29e3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions client/src/app/write/Modal/SaveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ function SaveModal({
const queryClient = useQueryClient();
// const isPrUpdate = pathname.startsWith('/write/pr/update');
const isPr = pathname.startsWith('/write/pr');
const {data: blogUrlData} = useGetBlogUrlQuery({
const { data: blogUrlData } = useGetBlogUrlQuery({
categoryId: categoryId,
});
const [blogUrl, setBlogUrl] = useState<IBlogUrl>();

const postWriteCreateQuery = useMutation(PostWriteApi, {
onSuccess: () => {

queryClient.invalidateQueries(['post']);
router.push(`/${blogUrl}`);
enqueueSnackbar({ message: '글 작성이 완료되었습니다.', variant: 'success' });
Expand All @@ -69,7 +68,7 @@ function SaveModal({
const updateWriteCreateQuery = useMutation(UpdateWriteApi, {
onSuccess: () => {
queryClient.invalidateQueries(['post']);
router.push('/home');
router.push(`/${blogUrl}`);
enqueueSnackbar({ message: '글 수정이 완료되었습니다.', variant: 'success' });
},
onError: (e: Error) => {
Expand All @@ -80,7 +79,7 @@ function SaveModal({
const postTemplateAddTemplate = useMutation(PostTemplateApi, {
onSuccess() {
queryClient.invalidateQueries(['template']);
enqueueSnackbar({ message: '글 수정이 완료되었습니다.', variant: 'success' });
enqueueSnackbar({ message: '템플릿 추가가 완료되었습니다.', variant: 'success' });
},
onError: (e: Error) => {
enqueueSnackbar({ message: e.message, variant: 'error' });
Expand All @@ -90,7 +89,7 @@ function SaveModal({
const postTemporaryAddTemplate = useMutation(PostTemporaryApi, {
onSuccess() {
queryClient.invalidateQueries(['temporaries']);
enqueueSnackbar({ message: '글 수정이 완료되었습니다.', variant: 'success' });
enqueueSnackbar({ message: '임시저장 글 저장이 완료되었습니다.', variant: 'success' });
},
onError: (e: Error) => {
enqueueSnackbar({ message: e.message, variant: 'error' });
Expand Down

0 comments on commit 20e29e3

Please sign in to comment.