mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +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 AreaForm from '@/components/pages/master-data/area/form/AreaForm';
|
import AreaForm from '@/components/pages/master-data/area/form/AreaForm';
|
||||||
|
|
||||||
import { AreaApi } from '@/services/api/master-data';
|
import { AreaApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const AreaEdit = () => {
|
const AreaEdit = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const AreaEdit = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingArea && !area) {
|
if (!isLoadingArea && (!area || isResponseError(area))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import AreaForm from '@/components/pages/master-data/area/form/AreaForm';
|
import AreaForm from '@/components/pages/master-data/area/form/AreaForm';
|
||||||
|
|
||||||
import { AreaApi } from '@/services/api/master-data';
|
import { AreaApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const AreaDetail = () => {
|
const AreaDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const AreaDetail = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingArea && !area) {
|
if (!isLoadingArea && (!area || isResponseError(area))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
||||||
|
|
||||||
import { KandangApi } from '@/services/api/master-data';
|
import { KandangApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const KandangEdit = () => {
|
const KandangEdit = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const KandangEdit = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingKandang && !kandang) {
|
if (!isLoadingKandang && (!kandang || isResponseError(kandang))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
import KandangForm from '@/components/pages/master-data/kandang/form/KandangForm';
|
||||||
|
|
||||||
import { KandangApi } from '@/services/api/master-data';
|
import { KandangApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const KandangDetail = () => {
|
const KandangDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const KandangDetail = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingKandang && !kandang) {
|
if (!isLoadingKandang && (!kandang || isResponseError(kandang))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
|
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
|
||||||
|
|
||||||
import { LocationApi } from '@/services/api/master-data';
|
import { LocationApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const LocationEdit = () => {
|
const LocationEdit = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const LocationEdit = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingLocation && !location) {
|
if (!isLoadingLocation && (!location || isResponseError(location))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
|
import LocationForm from '@/components/pages/master-data/location/form/LocationForm';
|
||||||
|
|
||||||
import { LocationApi } from '@/services/api/master-data';
|
import { LocationApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const LocationDetail = () => {
|
const LocationDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const LocationDetail = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingLocation && !location) {
|
if (!isLoadingLocation && (!location || isResponseError(location))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import UomForm from '@/components/pages/master-data/uom/form/UomForm';
|
import UomForm from '@/components/pages/master-data/uom/form/UomForm';
|
||||||
|
|
||||||
import { UomApi } from '@/services/api/master-data';
|
import { UomApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const UomEdit = () => {
|
const UomEdit = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -28,7 +28,7 @@ const UomEdit = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingUom && !uom) {
|
if (!isLoadingUom && (!uom || isResponseError(uom))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import UomForm from '@/components/pages/master-data/uom/form/UomForm';
|
import UomForm from '@/components/pages/master-data/uom/form/UomForm';
|
||||||
|
|
||||||
import { UomApi } from '@/services/api/master-data';
|
import { UomApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const UomDetail = () => {
|
const UomDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -28,7 +28,7 @@ const UomDetail = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingUom && !uom) {
|
if (!isLoadingUom && (!uom || isResponseError(uom))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import WarehouseForm from '@/components/pages/master-data/warehouse/form/WarehouseForm';
|
import WarehouseForm from '@/components/pages/master-data/warehouse/form/WarehouseForm';
|
||||||
|
|
||||||
import { WarehouseApi } from '@/services/api/master-data';
|
import { WarehouseApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const WarehouseEdit = () => {
|
const WarehouseEdit = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const WarehouseEdit = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingWarehouse && !warehouse) {
|
if (!isLoadingWarehouse && (!warehouse || isResponseError(warehouse))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import useSWR from 'swr';
|
|||||||
import WarehouseForm from '@/components/pages/master-data/warehouse/form/WarehouseForm';
|
import WarehouseForm from '@/components/pages/master-data/warehouse/form/WarehouseForm';
|
||||||
|
|
||||||
import { WarehouseApi } from '@/services/api/master-data';
|
import { WarehouseApi } from '@/services/api/master-data';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
const WarehouseDetail = () => {
|
const WarehouseDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -29,7 +29,7 @@ const WarehouseDetail = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingWarehouse && !warehouse) {
|
if (!isLoadingWarehouse && (!warehouse || isResponseError(warehouse))) {
|
||||||
router.replace('/404');
|
router.replace('/404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user