fix(frontend): update confirm dialog first prop type

This commit is contained in:
yassinedorbozgithub 2025-02-04 17:49:58 +01:00
parent 268dd6812b
commit 5197e57efa
3 changed files with 7 additions and 7 deletions

View File

@ -80,7 +80,7 @@ export const Categories = () => {
{ {
label: ActionColumnLabel.Delete, label: ActionColumnLabel.Delete,
action: async ({ id }) => { action: async ({ id }) => {
const isConfirmed = await dialogs.confirm(<ConfirmDialogBody />); const isConfirmed = await dialogs.confirm(ConfirmDialogBody);
if (isConfirmed) { if (isConfirmed) {
deleteCategory(id); deleteCategory(id);
@ -160,10 +160,10 @@ export const Categories = () => {
color="error" color="error"
variant="contained" variant="contained"
onClick={async () => { onClick={async () => {
const isConfirmed = await dialogs.confirm( const isConfirmed = await dialogs.confirm(ConfirmDialogBody, {
<ConfirmDialogBody />, mode: "selection",
{ mode: "selection", count: selectedCategories.length }, count: selectedCategories.length,
); });
if (isConfirmed) { if (isConfirmed) {
deleteCategories(selectedCategories); deleteCategories(selectedCategories);

View File

@ -38,7 +38,7 @@ export const useDialogs = (): DialogHook => {
ConfirmDialog, ConfirmDialog,
{ {
...rest, ...rest,
msg, msg: React.createElement(msg),
}, },
{ {
mode, mode,

View File

@ -114,7 +114,7 @@ export interface OpenConfirmDialog {
* @param options Additional options for the dialog. * @param options Additional options for the dialog.
* @returns A promise that resolves to true if the user confirms, false if the user cancels. * @returns A promise that resolves to true if the user confirms, false if the user cancels.
*/ */
(msg: React.ReactNode, options?: ConfirmOptions): Promise<boolean>; (msg: React.ComponentType, options?: ConfirmOptions): Promise<boolean>;
} }
export interface DialogHook { export interface DialogHook {