resolve scoping issue by fetching proxy summary
This commit is contained in:
1 parent
b2dca7b62f
commit
3f62c8ec6a
7 files changed
+43
-19
No files matched your search
@@ -484,10 +484,7 @@ const CreateMonitorPage = () => {
|
||||
})),
|
||||
[t]
|
||||
);
|
||||
const globalProxyName =
|
||||
appSettings?.settings?.globalProxyEnabled === true
|
||||
? proxies?.find((proxy) => proxy.id === appSettings?.settings?.globalProxyId)?.name
|
||||
: undefined;
|
||||
const globalProxyName = appSettings?.globalProxy?.name;
|
||||
|
||||
const proxyModeOptions = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -45,12 +45,7 @@ import { FormSwitchField } from "@/Components/inputs/forms/FormSwitchField";
|
||||
import { FormNumberField } from "@/Components/inputs/forms/FormNumberField";
|
||||
import { FormSelectField } from "@/Components/inputs/forms/FormSelectField";
|
||||
import type { ProxyResponse } from "@/Types/Proxy";
|
||||
|
||||
interface SettingsResponse {
|
||||
settings: any;
|
||||
pagespeedKeySet: boolean;
|
||||
emailPasswordSet: boolean;
|
||||
}
|
||||
import type { AppSettingsResponse } from "@/Types/Settings";
|
||||
|
||||
export const SettingsPage = () => {
|
||||
const theme = useTheme();
|
||||
@@ -66,9 +61,9 @@ export const SettingsPage = () => {
|
||||
const { post: importMonitors, loading: isImportingMonitors } = usePost();
|
||||
|
||||
// Fetch settings data from API
|
||||
const { data: fetchedSettings } = useGet<SettingsResponse>("/settings");
|
||||
const { data: fetchedSettings } = useGet<AppSettingsResponse>("/settings");
|
||||
// Get proxies
|
||||
const { data: proxies } = useGet<ProxyResponse[]>("/proxies/team");
|
||||
const { data: proxies } = useGet<ProxyResponse[]>("/proxies");
|
||||
const proxyOptions = useMemo(
|
||||
() =>
|
||||
(proxies ?? []).map((proxy) => ({
|
||||
@@ -79,7 +74,7 @@ export const SettingsPage = () => {
|
||||
);
|
||||
|
||||
// Form submission
|
||||
const { patch, loading: isSaving } = usePatch<SettingsFormData, SettingsResponse>();
|
||||
const { patch, loading: isSaving } = usePatch<SettingsFormData, AppSettingsResponse>();
|
||||
|
||||
// Local state for API key reset
|
||||
const [isApiKeySet, setIsApiKeySet] = useState(
|
||||
|
||||
@@ -33,5 +33,11 @@ export interface Settings {
|
||||
export interface AppSettingsResponse {
|
||||
pagespeedKeySet: boolean;
|
||||
emailPasswordSet: boolean;
|
||||
globalProxy: {
|
||||
id: string;
|
||||
name: string;
|
||||
host: string;
|
||||
port: number;
|
||||
} | null;
|
||||
settings: Settings;
|
||||
}
|
||||
Reference in new issue
Block a user