mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
Added toast notifications
This commit is contained in:
parent
feebdfcfe9
commit
ab86a3b871
8 changed files with 48 additions and 18 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue