chore(FE-41): redirect to /404 if response error

This commit is contained in:
ValdiANS
2025-10-05 16:19:37 +07:00
parent dcebd53c45
commit af60e682ee
10 changed files with 20 additions and 20 deletions
@@ -6,7 +6,7 @@ import useSWR from 'swr';
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
import { LocationApi } from '@/services/api/master-data';
import { isResponseSuccess } from '@/lib/api-helper';
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
const LocationEdit = () => {
const router = useRouter();
@@ -29,7 +29,7 @@ const LocationEdit = () => {
);
}
if (!isLoadingLocation && !location) {
if (!isLoadingLocation && (!location || isResponseError(location))) {
router.replace('/404');
return;
}
+2 -2
View File
@@ -6,7 +6,7 @@ import useSWR from 'swr';
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
import { LocationApi } from '@/services/api/master-data';
import { isResponseSuccess } from '@/lib/api-helper';
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
const LocationDetail = () => {
const router = useRouter();
@@ -29,7 +29,7 @@ const LocationDetail = () => {
);
}
if (!isLoadingLocation && !location) {
if (!isLoadingLocation && (!location || isResponseError(location))) {
router.replace('/404');
return;
}