Skip to content

Commit c2f6cce

Browse files
committed
Remove displayError, use displaySuccess
1 parent 23ba888 commit c2f6cce

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

site/src/components/GlobalSnackbar/utils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,3 @@ export const displayMsg = (msg: string, additionalMsg?: string): void => {
6060
export const displaySuccess = (msg: string, additionalMsg?: string): void => {
6161
dispatchNotificationEvent(MsgType.Success, msg, additionalMsg ? [additionalMsg] : undefined)
6262
}
63-
64-
export const displayError = (msg: string, additionalMsg?: string): void => {
65-
dispatchNotificationEvent(MsgType.Error, msg, additionalMsg ? [additionalMsg] : undefined)
66-
}

site/src/xServices/users/usersXService.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { assign, createMachine } from "xstate"
22
import * as API from "../../api"
33
import * as Types from "../../api/types"
44
import * as TypesGen from "../../api/typesGenerated"
5-
import { displayError } from "../../components/GlobalSnackbar/utils"
5+
import { displaySuccess } from "../../components/GlobalSnackbar/utils"
66

7-
const Language = {
8-
createUserError: "Unable to create user",
7+
export const Language = {
98
createUserSuccess: "Successfully created user",
109
}
1110

@@ -74,7 +73,7 @@ export const usersMachine = createMachine(
7473
},
7574
onError: {
7675
target: "idle",
77-
actions: ["assignCreateUserError", "displayCreateUserError"],
76+
actions: ["assignCreateUserError"],
7877
},
7978
},
8079
tags: "loading",
@@ -110,11 +109,8 @@ export const usersMachine = createMachine(
110109
...context,
111110
createUserError: undefined,
112111
})),
113-
displayCreateUserError: (_, event) => {
114-
displayError(Language.createUserError)
115-
},
116112
displayCreateUserSuccess: () => {
117-
displayError(Language.createUserSuccess)
113+
displaySuccess(Language.createUserSuccess)
118114
},
119115
},
120116
},

0 commit comments

Comments
 (0)