Added toast notifications

This commit is contained in:
JeyGR 2024-12-18 22:17:01 +05:30 committed by jey-exp
parent feebdfcfe9
commit ab86a3b871
8 changed files with 48 additions and 18 deletions

View file

@ -12,6 +12,7 @@ import { FormMessage } from '@radix-ui/react-form'
import { getAPIUrl } from '@services/config/config'
import { updateUserRole } from '@services/organizations/orgs'
import React, { useEffect } from 'react'
import toast from 'react-hot-toast'
import { BarLoader } from 'react-spinners'
import { mutate } from 'swr'
@ -44,9 +45,11 @@ function RolesUpdate(props: Props) {
if (res.status === 200) {
await mutate(`${getAPIUrl()}orgs/${org.id}/users`)
props.setRolesModal(false)
toast.success("Updated role")
} else {
setIsSubmitting(false)
setError('Error ' + res.status + ': ' + res.data.detail)
toast.error("Couldn't update now")
}
}