mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
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 {
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user