Skip to content

Commit

Permalink
feat(neuron-ui): add loading on creating networks
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Oct 15, 2019
1 parent b7f1b5a commit 8b89b1e
Showing 1 changed file with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,29 @@ export const toggleAddressBook = () => {
}

export const createNetwork = (params: Controller.CreateNetworkParams) => (dispatch: StateDispatch, history: any) => {
createRemoteNetwork(params).then(res => {
if (res.status === 1) {
addPopup('create-network-successfully')(dispatch)
history.push(Routes.SettingsNetworks)
} else {
addNotification(failureResToNotification(res))(dispatch)
}
dispatch({
type: AppActions.UpdateLoadings,
payload: {
network: true,
},
})
createRemoteNetwork(params)
.then(res => {
if (res.status === 1) {
addPopup('create-network-successfully')(dispatch)
history.push(Routes.SettingsNetworks)
} else {
addNotification(failureResToNotification(res))(dispatch)
}
})
.finally(() => {
dispatch({
type: AppActions.UpdateLoadings,
payload: {
network: false,
},
})
})
}

export const updateNetwork = (params: Controller.UpdateNetworkParams) => (dispatch: StateDispatch, history: any) => {
Expand Down

0 comments on commit 8b89b1e

Please sign in to comment.