Remove displayError, use displaySuccess

This commit is contained in:
Presley
2022-04-26 02:19:47 +00:00
parent 23ba888914
commit c2f6cce938
2 changed files with 4 additions and 12 deletions
@@ -60,7 +60,3 @@ export const displayMsg = (msg: string, additionalMsg?: string): void => {
export const displaySuccess = (msg: string, additionalMsg?: string): void => {
dispatchNotificationEvent(MsgType.Success, msg, additionalMsg ? [additionalMsg] : undefined)
}
export const displayError = (msg: string, additionalMsg?: string): void => {
dispatchNotificationEvent(MsgType.Error, msg, additionalMsg ? [additionalMsg] : undefined)
}
+4 -8
View File
@@ -2,10 +2,9 @@ import { assign, createMachine } from "xstate"
import * as API from "../../api"
import * as Types from "../../api/types"
import * as TypesGen from "../../api/typesGenerated"
import { displayError } from "../../components/GlobalSnackbar/utils"
import { displaySuccess } from "../../components/GlobalSnackbar/utils"
const Language = {
createUserError: "Unable to create user",
export const Language = {
createUserSuccess: "Successfully created user",
}
@@ -74,7 +73,7 @@ export const usersMachine = createMachine(
},
onError: {
target: "idle",
actions: ["assignCreateUserError", "displayCreateUserError"],
actions: ["assignCreateUserError"],
},
},
tags: "loading",
@@ -110,11 +109,8 @@ export const usersMachine = createMachine(
...context,
createUserError: undefined,
})),
displayCreateUserError: (_, event) => {
displayError(Language.createUserError)
},
displayCreateUserSuccess: () => {
displayError(Language.createUserSuccess)
displaySuccess(Language.createUserSuccess)
},
},
},