Added option to add multiple upstreams and hosts
This commit is contained in:
parent
505ba877bd
commit
8fe2a9fe76
2 changed files with 3 additions and 14 deletions
|
|
@ -1,20 +1,8 @@
|
|||
import { getUpstreamRequests } from '@/lib/serverActions';
|
||||
import { getRouteUpstreams } from '@/lib/utils';
|
||||
import { NextApiRequest } from 'next';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
|
||||
//TODO, Christ, maybe I'm not a dev
|
||||
if (!true) {
|
||||
return new NextResponse(JSON.stringify({error: true, message: "An error has occurred. Please check for a valid body and retry."}), {
|
||||
status: 400,
|
||||
headers: {
|
||||
'Content-Type': 'appliation/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let route: Route = await req.json();
|
||||
let upstreams: UpstreamRequest[] = await getUpstreamRequests(route);
|
||||
let routeUpstreams: Upstream[] = getRouteUpstreams(route);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export function EditRouteDialog({ route }: { route: Route }) {
|
|||
control: form.control,
|
||||
name: "hosts",
|
||||
})
|
||||
|
||||
|
||||
let onSubmit = ((data: any) => {
|
||||
pushUpdate(modifiedRoute);
|
||||
})
|
||||
|
|
@ -174,8 +174,9 @@ export function EditRouteDialog({ route }: { route: Route }) {
|
|||
)}
|
||||
/>
|
||||
))}
|
||||
|
||||
<Button type="submit">Save</Button>
|
||||
<Button type='button' onClick={() => {appendUpstreams('')}}>Add Host</Button>
|
||||
<Button type='button' onClick={() => {appendHosts('')}}>Add Upstream</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</DialogContent>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue