mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 09:49:13 +00:00
Feature: Toast Notification System (#25)
* Add react-hot-toaster to dependencies * Enable TailwindCSS 'jit' mode * Add Toast component * Add Toaster context for react-hot-toast * Add toast notification for queries, form validation fix * Add new animations for Toast component * fix: nickserv account validation Co-authored-by: Ludvig Lundgren <hello@ludviglundgren.se>
This commit is contained in:
parent
00f956870b
commit
11fcf1ead9
15 changed files with 195 additions and 14 deletions
|
@ -12,6 +12,9 @@ import APIClient from "../../api/APIClient";
|
|||
import { queryClient } from "../../App";
|
||||
import { PasswordFieldWide } from "../../components/inputs/wide";
|
||||
|
||||
import { toast } from 'react-hot-toast'
|
||||
import Toast from '../../components/notifications/Toast';
|
||||
|
||||
interface props {
|
||||
isOpen: boolean;
|
||||
toggle: any;
|
||||
|
@ -24,6 +27,7 @@ function IndexerUpdateForm({ isOpen, toggle, indexer }: props) {
|
|||
const mutation = useMutation((indexer: Indexer) => APIClient.indexers.update(indexer), {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(['indexer']);
|
||||
toast.custom((t) => <Toast type="success" body={`${indexer.name} was updated successfully`} t={t}/>)
|
||||
sleep(1500)
|
||||
|
||||
toggle()
|
||||
|
@ -33,6 +37,7 @@ function IndexerUpdateForm({ isOpen, toggle, indexer }: props) {
|
|||
const deleteMutation = useMutation((id: number) => APIClient.indexers.delete(id), {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(['indexer']);
|
||||
toast.custom((t) => <Toast type="success" body={`${indexer.name} was deleted.`} t={t}/>)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue