set resource password and remove resource password from dashboard

This commit is contained in:
Milo Schwartz
2024-11-19 00:05:04 -05:00
parent ab6d59c163
commit cfce3dabb3
10 changed files with 457 additions and 164 deletions

View File

@@ -88,6 +88,8 @@ export default function ReverseProxyTargets(props: {
const [loading, setLoading] = useState(false);
const [pageLoading, setPageLoading] = useState(true);
const addTargetForm = useForm({
resolver: zodResolver(addTargetSchema),
defaultValues: {
@@ -100,24 +102,26 @@ export default function ReverseProxyTargets(props: {
useEffect(() => {
const fetchSites = async () => {
const res = await api
.get<AxiosResponse<ListTargetsResponse>>(
try {
const res = await api.get<AxiosResponse<ListTargetsResponse>>(
`/resource/${params.resourceId}/targets`
)
.catch((err) => {
console.error(err);
toast({
variant: "destructive",
title: "Failed to fetch targets",
description: formatAxiosError(
err,
"An error occurred while fetching targets"
),
});
});
);
if (res && res.status === 200) {
setTargets(res.data.data.targets);
if (res.status === 200) {
setTargets(res.data.data.targets);
}
} catch (err) {
console.error(err);
toast({
variant: "destructive",
title: "Failed to fetch targets",
description: formatAxiosError(
err,
"An error occurred while fetching targets"
),
});
} finally {
setPageLoading(false);
}
};
fetchSites();
@@ -337,6 +341,10 @@ export default function ReverseProxyTargets(props: {
getFilteredRowModel: getFilteredRowModel(),
});
if (pageLoading) {
return <></>;
}
return (
<div>
<div className="space-y-6">