mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 06:45:46 +00:00
chore(FE-41): redirect to /404 if response error
This commit is contained in:
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
||||
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
||||
|
||||
import { KandangApi } from '@/services/api/master-data';
|
||||
import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
|
||||
const KandangEdit = () => {
|
||||
const router = useRouter();
|
||||
@@ -29,7 +29,7 @@ const KandangEdit = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingKandang && !kandang) {
|
||||
if (!isLoadingKandang && (!kandang || isResponseError(kandang))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
||||
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
||||
|
||||
import { KandangApi } from '@/services/api/master-data';
|
||||
import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
|
||||
const KandangDetail = () => {
|
||||
const router = useRouter();
|
||||
@@ -29,7 +29,7 @@ const KandangDetail = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingKandang && !kandang) {
|
||||
if (!isLoadingKandang && (!kandang || isResponseError(kandang))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user