[FEATURE] Initial autonav from creation
This commit is contained in:
parent
2e15db6368
commit
d4a5faa77c
1 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import { useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Autocomplete from "@mui/material/Autocomplete";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Box from "@mui/material/Box";
|
||||
|
@ -24,6 +25,7 @@ export default function Create() {
|
|||
const [wl, setWl] = useState([]);
|
||||
const [ops, setOps] = useState([]);
|
||||
const [spec, setSpec] = useState(defaultServer);
|
||||
const nav = useNavigate();
|
||||
const versionList = useVersionList();
|
||||
const [versions, setVersions] = useState(["latest"]);
|
||||
const createServer = useCreateServer(spec);
|
||||
|
@ -88,9 +90,11 @@ export default function Create() {
|
|||
|
||||
const opUpdate = (e) => alert("Op not implimented");
|
||||
|
||||
function upsertSpec() {
|
||||
async function upsertSpec() {
|
||||
if (validateSpec() !== "validated") return;
|
||||
createServer(spec);
|
||||
createServer(spec)
|
||||
.then(() => nav("/"))
|
||||
.catch(alert);
|
||||
}
|
||||
|
||||
function validateSpec() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue