fix: product and inventory
This commit is contained in:
+19
-4
@@ -133,11 +133,22 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
||||
const handleClickShowPassword = () => setIsPasswordShown(show => !show)
|
||||
|
||||
const onSubmit: SubmitHandler<FormData> = async (data: FormData) => {
|
||||
login.mutate(data)
|
||||
login.mutate(data, {
|
||||
onSuccess: (data: any) => {
|
||||
if (data?.user?.role === 'admin') {
|
||||
const redirectURL = searchParams.get('redirectTo') ?? '/dashboards/overview'
|
||||
|
||||
const redirectURL = searchParams.get('redirectTo') ?? '/dashboards/overview'
|
||||
router.replace(getLocalizedUrl(redirectURL, locale as Locale))
|
||||
} else {
|
||||
const redirectURL = searchParams.get('redirectTo') ?? '/sa/organizations/list'
|
||||
|
||||
router.replace(getLocalizedUrl(redirectURL, locale as Locale))
|
||||
router.replace(getLocalizedUrl(redirectURL, locale as Locale))
|
||||
}
|
||||
},
|
||||
onError: (error: any) => {
|
||||
setErrorState(error.response.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -243,7 +254,11 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
||||
</Button>
|
||||
<div className='flex justify-center items-center flex-wrap gap-2'>
|
||||
<Typography>New on our platform?</Typography>
|
||||
<Typography component={Link} href={getLocalizedUrl('/organization', locale as Locale)} color='primary.main'>
|
||||
<Typography
|
||||
component={Link}
|
||||
href={getLocalizedUrl('/organization', locale as Locale)}
|
||||
color='primary.main'
|
||||
>
|
||||
Create an account
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user