add settings response type, destructure

This commit is contained in:
Alex Holliday committed 2026-08-25 09:39:56 -07:00
1 parent ccfda938d5
commit 0c21dcdd2a
2 files changed
+8 -6

No files matched your search

+6 -6
View File
@@ -46,6 +46,7 @@ import {
} from "@/Types/Monitor"; } from "@/Types/Monitor";
import type { Notification } from "@/Types/Notification"; import type { Notification } from "@/Types/Notification";
import type { Tag } from "@/Types/Tag"; import type { Tag } from "@/Types/Tag";
import type { AppSettingsResponse } from "@/Types/Settings";
import { import {
stepFieldsFor, stepFieldsFor,
monitorStepCount, monitorStepCount,
@@ -273,10 +274,7 @@ const CreateMonitorPage = () => {
const { data: games } = useGet<GamesMap>("/monitors/games"); const { data: games } = useGet<GamesMap>("/monitors/games");
const { data: tags } = useGet<Tag[]>("/tags/team"); const { data: tags } = useGet<Tag[]>("/tags/team");
const { data: proxies } = useGet<ProxyResponse[]>("/proxies/team"); const { data: proxies } = useGet<ProxyResponse[]>("/proxies/team");
const { data: appSettings } = useGet<{ const { data: appSettings } = useGet<AppSettingsResponse>("/settings");
globalProxyEnabled?: boolean;
globalProxyId?: string | null;
}>("/settings");
const { schema, defaults } = useMonitorForm({ const { schema, defaults } = useMonitorForm({
data: existingMonitor ?? null, data: existingMonitor ?? null,
@@ -505,10 +503,12 @@ const CreateMonitorPage = () => {
); );
const globalProxyName = const globalProxyName =
appSettings?.globalProxyEnabled === true appSettings?.settings?.globalProxyEnabled === true
? proxies?.find((proxy) => proxy.id === appSettings?.globalProxyId)?.name ? proxies?.find((proxy) => proxy.id === appSettings?.settings?.globalProxyId)?.name
: undefined; : undefined;
console.log({ appSettings });
return ( return (
<FormProvider {...form}> <FormProvider {...form}>
<BasePage <BasePage
+2
View File
@@ -24,6 +24,8 @@ export interface Settings {
showURL: boolean; showURL: boolean;
singleton: boolean; singleton: boolean;
globalThresholds?: SettingsThresholds; globalThresholds?: SettingsThresholds;
globalProxyEnabled: boolean;
globalProxyId?: string | null;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
} }