diff --git a/src/index.html b/src/index.html index e1faf23..5741c3b 100644 --- a/src/index.html +++ b/src/index.html @@ -15,7 +15,7 @@

- Sign-up + Sign-up

Please use this if you have yet to activate an account on Skynet before. @@ -23,7 +23,7 @@

- Change Password + Change Password

Please use this service to change your Skynet password @@ -31,7 +31,7 @@

- Account modification + Account modification

Please use this service to modify your user data (email, login ssh key, etc.) diff --git a/src/js/lib.js b/src/js/lib.js new file mode 100644 index 0000000..2b585dd --- /dev/null +++ b/src/js/lib.js @@ -0,0 +1,28 @@ + + +export async function post_request(url, body, form_status){ + let req; + + try { + req = await fetch(url, { + method: 'POST', + body: JSON.stringify(body), + mode: "cors" + }); + } catch (e) { + form_status.innerHTML = `${e}`; + return; + } + + if (req.status !== 200) { + form_status.innerHTML = "Failure"; + return; + } + + let temp = await req.json(); + if (temp.result === 'error') { + form_status.innerHTML = `${temp.error}`; + } else { + form_status.innerHTML = "Success"; + } +} \ No newline at end of file diff --git a/src/modify.html b/src/modify.html index 6bf131a..2498418 100644 --- a/src/modify.html +++ b/src/modify.html @@ -3,13 +3,13 @@ Modify Account - - + +

@@ -17,7 +17,7 @@

Modify details of your Skynet account.

-
+ @@ -28,15 +28,14 @@ - + @@ -45,57 +44,12 @@ - +

- -

- +