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}`,
|
||||
})
|
||||
|
||||
export const taskUpdateSuccess = (): Notification => ({
|
||||
...defaultSuccessNotification,
|
||||
duration: FIVE_SECONDS,
|
||||
message: 'Task was updated successfully',
|
||||
})
|
||||
|
||||
export const taskImportFailed = (
|
||||
fileName: string,
|
||||
errorMessage: string
|
||||
|
|
|
@ -24,6 +24,7 @@ import {
|
|||
taskUpdateFailed,
|
||||
taskImportFailed,
|
||||
taskImportSuccess,
|
||||
taskUpdateSuccess,
|
||||
} from 'src/shared/copy/v2/notifications'
|
||||
|
||||
// Types
|
||||
|
@ -229,10 +230,11 @@ export const updateTaskStatus = (task: Task) => async dispatch => {
|
|||
await updateTaskStatusAPI(task.id, task.status)
|
||||
|
||||
dispatch(populateTasks())
|
||||
dispatch(notify(taskUpdateSuccess()))
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
const message = getErrorMessage(e)
|
||||
dispatch(notify(taskDeleteFailed(message)))
|
||||
dispatch(notify(taskUpdateFailed(message)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue