Skip to content
Snippets Groups Projects
Unverified Commit 2dfd725e authored by GyDi's avatar GyDi
Browse files

fix: reset value correctly

parent 5b779b4f
No related branches found
No related tags found
No related merge requests found
import { useState } from "react";
import { useEffect, useState } from "react";
import {
Button,
Dialog,
......@@ -28,6 +28,13 @@ const ProfileNew = (props: Props) => {
onSubmit(name, desc);
};
useEffect(() => {
if (!open) {
setName("");
setDesc("");
}
}, [open]);
return (
<Dialog open={open} onClose={onClose}>
<DialogTitle>Create Profile</DialogTitle>
......
......@@ -104,8 +104,8 @@ const ProfilePage = () => {
try {
await newProfile(name, desc);
mutate("getProfiles");
setDialogOpen(false);
mutate("getProfiles");
} catch (err: any) {
err && Notice.error(err.toString());
} finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment