fix: admin buttons issue

This commit is contained in:
swve 2023-07-14 11:29:15 +01:00
parent 466616578a
commit 99890a950b
6 changed files with 18 additions and 14 deletions

View file

@ -9,20 +9,22 @@ function GetStarted() {
const { data: install, error: error, isLoading } = useSWR(`${getAPIUrl()}install/latest`, swrFetcher);
const router = useRouter()
function startInstallation() {
fetch(`${getAPIUrl()}install/start`, {
async function startInstallation() {
let res = await fetch(`${getAPIUrl()}install/start`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({})
}).then(res => res.json()).then(res => {
if (res.success) {
mutate(`${getAPIUrl()}install/latest`)
router.push(`/install?step=1`)
}
})
if (res.status == 200) {
mutate(`${getAPIUrl()}install/latest`)
router.refresh();
router.push(`/install?step=1`)
}
}
function redirectToStep() {