fix: reset value correctly
This commit is contained in:
parent
5b779b4f14
commit
2dfd725ee0
@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
@ -28,6 +28,13 @@ const ProfileNew = (props: Props) => {
|
|||||||
onSubmit(name, desc);
|
onSubmit(name, desc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) {
|
||||||
|
setName("");
|
||||||
|
setDesc("");
|
||||||
|
}
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onClose={onClose}>
|
<Dialog open={open} onClose={onClose}>
|
||||||
<DialogTitle>Create Profile</DialogTitle>
|
<DialogTitle>Create Profile</DialogTitle>
|
||||||
|
@ -104,8 +104,8 @@ const ProfilePage = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await newProfile(name, desc);
|
await newProfile(name, desc);
|
||||||
mutate("getProfiles");
|
|
||||||
setDialogOpen(false);
|
setDialogOpen(false);
|
||||||
|
mutate("getProfiles");
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
err && Notice.error(err.toString());
|
err && Notice.error(err.toString());
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user