add bottom padding to main,
improve error handling with request function
This commit is contained in:
parent
54ecfaf782
commit
4e4b63f63a
@ -53,7 +53,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<section class="w3-container">
|
<section>
|
||||||
<h2>Account</h2>
|
<h2>Account</h2>
|
||||||
<div class="w3-card w3-padding">
|
<div class="w3-card w3-padding">
|
||||||
<h3>Account Details</h3>
|
<h3>Account Details</h3>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<section class="w3-container">
|
<section>
|
||||||
<h2 id="name"><a href="index.html">Instances</a> / %{vmname}</h2>
|
<h2 id="name"><a href="index.html">Instances</a> / %{vmname}</h2>
|
||||||
<form>
|
<form>
|
||||||
<fieldset class="w3-card w3-padding">
|
<fieldset class="w3-card w3-padding">
|
||||||
|
@ -43,6 +43,10 @@ main, dialog {
|
|||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 0 16px 16px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.w3-card {
|
.w3-card {
|
||||||
background-color: var(--main-card-bg-color);
|
background-color: var(--main-card-bg-color);
|
||||||
box-shadow: var(--main-card-box-shadow);
|
box-shadow: var(--main-card-box-shadow);
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<section class="w3-container">
|
<section>
|
||||||
<h2>Instances</h2>
|
<h2>Instances</h2>
|
||||||
<div class="w3-card w3-padding">
|
<div class="w3-card w3-padding">
|
||||||
<div class="flex row nowrap" style="margin-top: 1em; justify-content: space-between;">
|
<div class="flex row nowrap" style="margin-top: 1em; justify-content: space-between;">
|
||||||
|
@ -207,6 +207,7 @@ export async function requestAPI (path, method, body = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function request (url, content) {
|
async function request (url, content) {
|
||||||
|
try {
|
||||||
const response = await fetch(url, content);
|
const response = await fetch(url, content);
|
||||||
const contentType = response.headers.get("Content-Type");
|
const contentType = response.headers.get("Content-Type");
|
||||||
let data = null;
|
let data = null;
|
||||||
@ -221,7 +222,6 @@ async function request (url, content) {
|
|||||||
else {
|
else {
|
||||||
data = response;
|
data = response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return { status: response.status, error: data ? data.error : response.status };
|
return { status: response.status, error: data ? data.error : response.status };
|
||||||
}
|
}
|
||||||
@ -230,6 +230,10 @@ async function request (url, content) {
|
|||||||
return data || response;
|
return data || response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (error) {
|
||||||
|
return {status: 400, error: error};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function goToPage (page, data = null) {
|
export function goToPage (page, data = null) {
|
||||||
const params = data ? (new URLSearchParams(data)).toString() : "";
|
const params = data ? (new URLSearchParams(data)).toString() : "";
|
||||||
|
Loading…
Reference in New Issue
Block a user