Fix mark as accepted not updating state

This commit is contained in:
yashkanakiya
2021-12-01 13:52:12 +00:00
committed by Mohit Panjwani
parent e1ef208073
commit d839962292

View File

@ -278,12 +278,19 @@ export const useEstimateStore = (useWindow = false) => {
axios axios
.post(`/api/v1/estimates/${data.id}/status`, data) .post(`/api/v1/estimates/${data.id}/status`, data)
.then((response) => { .then((response) => {
let pos = this.estimates.findIndex(
(estimate) => estimate.id === data.id
)
if (this.estimates[pos]) {
this.estimates[pos].status = 'ACCEPTED'
const notificationStore = useNotificationStore() const notificationStore = useNotificationStore()
notificationStore.showNotification({ notificationStore.showNotification({
type: 'success', type: 'success',
message: global.t('estimates.marked_as_accepted_message'), message: global.t('estimates.marked_as_accepted_message'),
}) })
}
resolve(response) resolve(response)
}) })
.catch((err) => { .catch((err) => {