Add a dialog when a family was created
This commit is contained in:
parent
5b06886c71
commit
817d14ef36
@ -2,6 +2,7 @@ import React from "react";
|
|||||||
import { TextInputDialog } from "./TextInputDialog";
|
import { TextInputDialog } from "./TextInputDialog";
|
||||||
import { ServerApi } from "../api/ServerApi";
|
import { ServerApi } from "../api/ServerApi";
|
||||||
import { FamilyApi } from "../api/FamilyApi";
|
import { FamilyApi } from "../api/FamilyApi";
|
||||||
|
import { useAlert } from "../widgets/AlertDialogProvider";
|
||||||
|
|
||||||
export function CreateFamilyDialog(p: {
|
export function CreateFamilyDialog(p: {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@ -12,6 +13,8 @@ export function CreateFamilyDialog(p: {
|
|||||||
const [creating, setCreating] = React.useState(false);
|
const [creating, setCreating] = React.useState(false);
|
||||||
const [error, setError] = React.useState(false);
|
const [error, setError] = React.useState(false);
|
||||||
|
|
||||||
|
const alert = useAlert();
|
||||||
|
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
setName("");
|
setName("");
|
||||||
setCreating(false);
|
setCreating(false);
|
||||||
@ -25,6 +28,7 @@ export function CreateFamilyDialog(p: {
|
|||||||
await FamilyApi.CreateFamily(name);
|
await FamilyApi.CreateFamily(name);
|
||||||
setName("");
|
setName("");
|
||||||
p.onCreated();
|
p.onCreated();
|
||||||
|
await alert.alert("La famille a été créée avec succès !");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
setError(true);
|
setError(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user