mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-13 07:25:05 +02:00
reset create resource form on dialog close closes #145
This commit is contained in:
parent
94ce5edc61
commit
6a8132546e
1 changed files with 9 additions and 2 deletions
|
@ -129,9 +129,7 @@ export default function CreateResourceForm({
|
|||
|
||||
const [sites, setSites] = useState<ListSitesResponse["sites"]>([]);
|
||||
const [domainSuffix, setDomainSuffix] = useState<string>(org.org.domain);
|
||||
|
||||
const [showSnippets, setShowSnippets] = useState(false);
|
||||
|
||||
const [resourceId, setResourceId] = useState<number | null>(null);
|
||||
|
||||
const form = useForm<CreateResourceFormValues>({
|
||||
|
@ -144,11 +142,20 @@ export default function CreateResourceForm({
|
|||
}
|
||||
});
|
||||
|
||||
function reset() {
|
||||
form.reset();
|
||||
setSites([]);
|
||||
setShowSnippets(false);
|
||||
setResourceId(null);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
return;
|
||||
}
|
||||
|
||||
reset();
|
||||
|
||||
const fetchSites = async () => {
|
||||
const res = await api.get<AxiosResponse<ListSitesResponse>>(
|
||||
`/org/${orgId}/sites/`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue