Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 8, 2023
1 parent 6a5edc1 commit c323e03
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/socket/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,19 @@ export const eventHandler = (

case EventTypes.POST_DELETE: {
const post = data as PostModel
if (getGlobalCurrentPostData()?.id === post.id) {
router.replace(routeBuilder(Routes.PageDeletd, {}))
toast.error('文章已删除')
if (
location.pathname ===
routeBuilder(Routes.Post, {
category: post.category.slug,
slug: post.slug,
})
) {
if (getGlobalCurrentPostData()?.id === post.id) {
router.replace(routeBuilder(Routes.PageDeletd, {}))
toast.error('文章已删除')
}
}

break
}

Expand All @@ -85,10 +94,18 @@ export const eventHandler = (

case EventTypes.NOTE_DELETE: {
const note = data as NoteModel
if (getCurrentNoteData()?.data.id === note.id) {
router.replace(routeBuilder(Routes.PageDeletd, {}))
toast.error('手记已删除')
if (
location.pathname ===
routeBuilder(Routes.Note, {
id: note.id,
})
) {
if (getCurrentNoteData()?.data.id === note.id) {
router.replace(routeBuilder(Routes.PageDeletd, {}))
toast.error('手记已删除')
}
}

break
}

Expand Down

1 comment on commit c323e03

@vercel
Copy link

@vercel vercel bot commented on c323e03 Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

springtide.vercel.app
innei.in
shiro-git-main-innei.vercel.app
shiro-innei.vercel.app

Please sign in to comment.