diff --git a/src/components/work/CaseFlag.vue b/src/components/work/CaseFlag.vue index 7668426c9..2548caf20 100644 --- a/src/components/work/CaseFlag.vue +++ b/src/components/work/CaseFlag.vue @@ -397,6 +397,7 @@ import { What3wordsService } from '../../services/what3words.service'; import useCurrentUser from '../../hooks/useCurrentUser'; import type { CaseFlag } from '@/models/types'; import type Incident from '@/models/Incident'; +import { getErrorMessage } from '@/utils/errors'; export default defineComponent({ name: 'CaseFlag', @@ -464,8 +465,6 @@ export default defineComponent({ emit('reloadMap', props.worksiteId || route.params.id); if (props.incidentId) { emit('clearCase'); - } else { - await router.push(`/incident/${route.params.incident_id}/cases/new`); } return; @@ -559,10 +558,9 @@ export default defineComponent({ props.worksiteId || route.params.id, props.incidentId || route.params.incident_id, ); - } catch { - await router.push( - `/incident/${props.incidentId || route.params.incident_id}/cases/new`, - ); + } catch (error) { + console.error(error); + getErrorMessage(error); } finally { ready.value = true; } diff --git a/src/components/work/CaseHistory.vue b/src/components/work/CaseHistory.vue index dc07a3842..22881e6b0 100644 --- a/src/components/work/CaseHistory.vue +++ b/src/components/work/CaseHistory.vue @@ -53,6 +53,7 @@ import User from '@/models/User'; import Organization from '@/models/Organization'; import { groupBy } from '@/utils/array'; import Worksite from '@/models/Worksite'; +import { getErrorMessage } from '@/utils/errors'; export default defineComponent({ name: 'CaseHistory', @@ -104,10 +105,9 @@ export default defineComponent({ const result = await Worksite.api().getHistory(props.worksiteId); worksiteHistory.value = result.response.data; - } catch { - await router.push( - `/incident/${props.incidentId || route.params.incident_id}/cases/new`, - ); + } catch (error) { + console.error(error); + getErrorMessage(error); } finally { ready.value = true; }