Skip to content

Commit

Permalink
feat: add toast on create
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswhong committed Sep 26, 2019
1 parent 839b432 commit 0fc9957
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/reducers/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ipcRenderer.send('block-menus', true)

const [, DATASET_SUCC] = apiActionTypes('dataset')
const [, ADD_SUCC] = apiActionTypes('add')
const [, INIT_SUCC] = apiActionTypes('init')

export default (state = initialState, action: AnyAction) => {
switch (action.type) {
Expand Down Expand Up @@ -171,12 +172,13 @@ export default (state = initialState, action: AnyAction) => {
}

case ADD_SUCC:
case INIT_SUCC:
const { peername, name } = action.payload.data
return {
...state,
toast: {
type: 'success',
message: `Added dataset ${peername}/${name}`,
message: `${action.type === ADD_SUCC ? 'Added' : 'Created new'} dataset ${peername}/${name}`,
visible: true
}
}
Expand Down

0 comments on commit 0fc9957

Please sign in to comment.