Show notification when task status is updated

pull/11449/head
Palak Bhojani 2019-01-22 15:46:58 -08:00
parent 8a411c1570
commit 8fe375f59b
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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)))
}
}