mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 06:15:47 +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 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user