Skip to content

Commit e45f871

Browse files
committed
chore: Refactor series remove
1 parent b5ea8ad commit e45f871

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/containers/velog/SeriesPosts.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,28 @@ const SeriesPosts: React.FC<SeriesPostsProps> = ({ username, urlSlug }) => {
5757
const onConfirmRemove = async () => {
5858
try {
5959
setIsSkip(true);
60+
setAskRemove(false);
61+
62+
if (!data?.series?.id) {
63+
throw new Error('Series ID is not available');
64+
}
65+
6066
await removeSeries({
6167
variables: {
62-
id: data?.series?.id,
68+
id: data.series.id,
6369
},
6470
});
6571

6672
await client.resetStore();
6773

68-
const redirect = `${process.env
69-
.REACT_APP_CLIENT_V3_HOST!}/@${username}/series`;
70-
71-
setTimeout(() => {
72-
window.location.href = redirect;
73-
}, 100);
74+
toast.success('시리즈가 성공적으로 삭제되었습니다.', {
75+
autoClose: 800,
76+
onClose: () => {
77+
const redirect = `${process.env
78+
.REACT_APP_CLIENT_V3_HOST!}/@${username}/series`;
79+
window.location.href = redirect;
80+
},
81+
});
7482
} catch (e) {
7583
toast.error('시리즈 삭제 실패');
7684
}

0 commit comments

Comments
 (0)