mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
refactor: simplify config api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { APIErrorResponse, PackerConfig, ServerConfig } from "@/types/memshell";
|
||||
import type { APIErrorResponse, PackerConfig } from "@/types/memshell";
|
||||
import type { ProbeShellGenerateResponse, ProbeShellResult } from "@/types/probeshell";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -22,13 +22,13 @@ import {
|
||||
} from "@/types/schema";
|
||||
import { transformToProbePostData } from "@/utils/transformer";
|
||||
|
||||
import { baseOptions } from "../lib/layout.shared";
|
||||
import { baseOptions } from "@/lib/layout.shared";
|
||||
|
||||
export default function ProbeShellGenerator() {
|
||||
const { data: serverConfig } = useQuery<ServerConfig>({
|
||||
queryKey: ["serverConfig"],
|
||||
const { data: responseBodyServers } = useQuery<string[]>({
|
||||
queryKey: ["probeResponseBodyServers"],
|
||||
queryFn: async () => {
|
||||
const response = await fetch(`${env.API_URL}/api/config/servers`);
|
||||
const response = await fetch(`${env.API_URL}/api/config/probe/response-body/servers`);
|
||||
return await response.json();
|
||||
},
|
||||
});
|
||||
@@ -102,7 +102,7 @@ export default function ProbeShellGenerator() {
|
||||
<div className="max-w-8xl container mx-auto p-6">
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-col gap-6 xl:flex-row">
|
||||
<div className="flex w-full flex-col gap-2 xl:w-1/2">
|
||||
<MainConfigCard form={form} servers={serverConfig} />
|
||||
<MainConfigCard form={form} responseBodyServers={responseBodyServers} />
|
||||
<PackageConfigCard form={form} packerConfig={packerConfig} />
|
||||
<Button className="w-full" type="submit" disabled={form.formState.isSubmitting}>
|
||||
{form.formState.isSubmitting ? (
|
||||
|
||||
Reference in New Issue
Block a user