Skip to content

Commit

Permalink
feat: add toast ui for better UX (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaddeusJiang authored Sep 6, 2023
1 parent 8448784 commit 83a28c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 4 additions & 0 deletions components/ui/Avatar/AvatarCardWithMarkIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { toast } from "react-hot-toast"

import Link from "next/link"
import { useRouter } from "next/router"

Expand All @@ -23,6 +25,7 @@ export function AvatarCardWithMarkIcon({ avatar }: { avatar: Avatar & { isMarked
return res.json()
},
onSuccess: () => {
toast.success("Marked")
router.replace(router.asPath)
}
})
Expand All @@ -39,6 +42,7 @@ export function AvatarCardWithMarkIcon({ avatar }: { avatar: Avatar & { isMarked
return res.json()
},
onSuccess: () => {
toast.success("Unmarked")
router.replace(router.asPath)
}
})
Expand Down
5 changes: 1 addition & 4 deletions components/ui/Avatar/AvatarProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ export const AvatarProfileHeader = ({ username, isSetting = false }: { username:
},
onSuccess: () => {
toast.success("Status changed")
router.push({
href: router.pathname,
query: router.query
})
router.replace(router.asPath)
}
})

Expand Down
5 changes: 1 addition & 4 deletions pages/settings/avatars/[username]/export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ export default function AvatarExportPage({ archives }: { archives: any[] }) {
},
onSuccess: () => {
toast.success("Request sent")
router.push({
href: router.pathname,
query: router.query
})
router.replace(router.asPath)
}
})

Expand Down

1 comment on commit 83a28c3

@vercel
Copy link

@vercel vercel bot commented on 83a28c3 Sep 6, 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:

aier – ./

aier-thaddeusjiang.vercel.app
aier-git-dev-thaddeusjiang.vercel.app
www.aier.app
aier.app

Please sign in to comment.