mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Remove displayError, use displaySuccess
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user