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 { getUpstreamRequests } from '@/lib/serverActions';
|
||||||
import { getRouteUpstreams } from '@/lib/utils';
|
import { getRouteUpstreams } from '@/lib/utils';
|
||||||
import { NextApiRequest } from 'next';
|
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
export async function POST(req: Request) {
|
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 route: Route = await req.json();
|
||||||
let upstreams: UpstreamRequest[] = await getUpstreamRequests(route);
|
let upstreams: UpstreamRequest[] = await getUpstreamRequests(route);
|
||||||
let routeUpstreams: Upstream[] = getRouteUpstreams(route);
|
let routeUpstreams: Upstream[] = getRouteUpstreams(route);
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,9 @@ export function EditRouteDialog({ route }: { route: Route }) {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<Button type="submit">Save</Button>
|
<Button type="submit">Save</Button>
|
||||||
|
<Button type='button' onClick={() => {appendUpstreams('')}}>Add Host</Button>
|
||||||
|
<Button type='button' onClick={() => {appendHosts('')}}>Add Upstream</Button>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue