fix: product and inventory

This commit is contained in:
ferdiansyah783
2025-08-13 23:53:03 +07:00
parent ea6205cfa7
commit ba7911d04b
28 changed files with 435 additions and 204 deletions
+19 -4
View File
@@ -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>