Skip to content

Commit

Permalink
fix(dashboard): delete user messages (medusajs#11004)
Browse files Browse the repository at this point in the history
CLOSES CMRC-760
  • Loading branch information
fPolic authored Jan 16, 2025
1 parent 5eab9e7 commit 911eefa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
16 changes: 14 additions & 2 deletions packages/admin/dashboard/src/i18n/translations/$schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2442,11 +2442,19 @@
"type": "string"
}
},
"required": ["alreadyManaged", "alreadyManagedWithSku"],
"required": [
"alreadyManaged",
"alreadyManagedWithSku"
],
"additionalProperties": false
}
},
"required": ["heading", "description", "loading", "tooltips"],
"required": [
"heading",
"description",
"loading",
"tooltips"
],
"additionalProperties": false
},
"toasts": {
Expand Down Expand Up @@ -8338,6 +8346,9 @@
"deleteUserWarning": {
"type": "string"
},
"deleteUserSuccess": {
"type": "string"
},
"invite": {
"type": "string"
}
Expand All @@ -8358,6 +8369,7 @@
"inviteStatus",
"roles",
"deleteUserWarning",
"deleteUserSuccess",
"invite"
],
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions packages/admin/dashboard/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,7 @@
"member": "Member"
},
"deleteUserWarning": "You are about to delete the user {{name}}. This action cannot be undone.",
"deleteUserSuccess": "User {{name}} deleted successfully",
"invite": "Invite"
},
"store": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PencilSquare, Trash } from "@medusajs/icons"
import { HttpTypes } from "@medusajs/types"
import { Container, Heading, Text, usePrompt } from "@medusajs/ui"
import { Container, Heading, Text, toast, usePrompt } from "@medusajs/ui"
import { useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom"
import { ActionMenu } from "../../../../../components/common/action-menu"
Expand Down Expand Up @@ -37,8 +37,12 @@ export const UserGeneralSection = ({ user }: UserGeneralSectionProps) => {

await mutateAsync(undefined, {
onSuccess: () => {
toast.success(t("users.deleteUserSuccess", { name: user.email }))
navigate("..")
},
onError: (error) => {
toast.error(error.message)
},
})
}

Expand Down

0 comments on commit 911eefa

Please sign in to comment.