diff --git a/UI/src/components/mixins/RipaApiStopJobMixin.vue b/UI/src/components/mixins/RipaApiStopJobMixin.vue index 56f61d3ee..1183f8808 100644 --- a/UI/src/components/mixins/RipaApiStopJobMixin.vue +++ b/UI/src/components/mixins/RipaApiStopJobMixin.vue @@ -208,6 +208,7 @@ export default { return } await this.submitOfficerStop(apiStop) + this.removeSingleApiStopFromLocalStorage(apiStop) await this.timeout(1500) } @@ -273,6 +274,22 @@ export default { localStorage.removeItem('ripa_submitted_api_stops') }, + removeSingleApiStopFromLocalStorage(apiStop) { + const apiStops = JSON.parse( + localStorage.getItem('ripa_submitted_api_stops'), + ) + + const index = apiStops.findIndex(s => s.time === apiStop.time) + + if (index > -1) { + apiStops.splice(index, 1) + localStorage.setItem( + 'ripa_submitted_api_stops', + JSON.stringify(apiStops), + ) + } + }, + getApiStopsFromLocalStorage() { const apiStops = localStorage.getItem('ripa_submitted_api_stops') return apiStops ? JSON.parse(apiStops) : [] diff --git a/UI/src/store/index.js b/UI/src/store/index.js index aebdfad00..25bf2746f 100644 --- a/UI/src/store/index.js +++ b/UI/src/store/index.js @@ -911,6 +911,7 @@ export default new Vuex.Store({ if (router.currentRoute.fullPath === '/admin') { dispatch('getAdminStops') } + return apiStop } if (response.status !== 200) { const errorStop = {