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 { ServerApi } from "../api/ServerApi";
|
||||
import { FamilyApi } from "../api/FamilyApi";
|
||||
import { useAlert } from "../widgets/AlertDialogProvider";
|
||||
|
||||
export function CreateFamilyDialog(p: {
|
||||
open: boolean;
|
||||
@ -12,6 +13,8 @@ export function CreateFamilyDialog(p: {
|
||||
const [creating, setCreating] = React.useState(false);
|
||||
const [error, setError] = React.useState(false);
|
||||
|
||||
const alert = useAlert();
|
||||
|
||||
const cancel = () => {
|
||||
setName("");
|
||||
setCreating(false);
|
||||
@ -25,6 +28,7 @@ export function CreateFamilyDialog(p: {
|
||||
await FamilyApi.CreateFamily(name);
|
||||
setName("");
|
||||
p.onCreated();
|
||||
await alert.alert("La famille a été créée avec succès !");
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setError(true);
|
||||
|
Loading…
Reference in New Issue
Block a user