Show notification when task status is updated
parent
8a411c1570
commit
8fe375f59b
|
@ -43,6 +43,12 @@ export const taskUpdateFailed = (additionalMessage: string): Notification => ({
|
||||||
message: `Failed to update task: ${additionalMessage}`,
|
message: `Failed to update task: ${additionalMessage}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const taskUpdateSuccess = (): Notification => ({
|
||||||
|
...defaultSuccessNotification,
|
||||||
|
duration: FIVE_SECONDS,
|
||||||
|
message: 'Task was updated successfully',
|
||||||
|
})
|
||||||
|
|
||||||
export const taskImportFailed = (
|
export const taskImportFailed = (
|
||||||
fileName: string,
|
fileName: string,
|
||||||
errorMessage: string
|
errorMessage: string
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
taskUpdateFailed,
|
taskUpdateFailed,
|
||||||
taskImportFailed,
|
taskImportFailed,
|
||||||
taskImportSuccess,
|
taskImportSuccess,
|
||||||
|
taskUpdateSuccess,
|
||||||
} from 'src/shared/copy/v2/notifications'
|
} from 'src/shared/copy/v2/notifications'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
@ -229,10 +230,11 @@ export const updateTaskStatus = (task: Task) => async dispatch => {
|
||||||
await updateTaskStatusAPI(task.id, task.status)
|
await updateTaskStatusAPI(task.id, task.status)
|
||||||
|
|
||||||
dispatch(populateTasks())
|
dispatch(populateTasks())
|
||||||
|
dispatch(notify(taskUpdateSuccess()))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
const message = getErrorMessage(e)
|
const message = getErrorMessage(e)
|
||||||
dispatch(notify(taskDeleteFailed(message)))
|
dispatch(notify(taskUpdateFailed(message)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue