Compare commits
4 Commits
0.1.6
...
feature/18
| Author | SHA1 | Date | |
|---|---|---|---|
| eb023fac5c | |||
| 26951b4f0f | |||
| e6d8861340 | |||
| 37c384aa36 |
@@ -1,17 +1,19 @@
|
||||
<script>
|
||||
import isURL from "validator/lib/isURL";
|
||||
import isUUID from "validator/lib/isUUID";
|
||||
import { apikey, lang, stationinfo, api_endpoint } from "./store.js";
|
||||
import { apikey, lang, stationinfo, api_endpoint, page } from "./store.js";
|
||||
import axios from "axios";
|
||||
import background from "./kaya_kids_background.jpg";
|
||||
import { _, locale } from "svelte-i18n";
|
||||
let token;
|
||||
let api_endpoint_input = "";
|
||||
$: error = false;
|
||||
$: errormessage = "";
|
||||
$: isTokenValid =
|
||||
token?.length === 44 &&
|
||||
token.split(".")[0].length === 7 &&
|
||||
isUUID(token.split(".")[1]);
|
||||
token === "rst" ||
|
||||
(token?.length === 44 &&
|
||||
token.split(".")[0].length === 7 &&
|
||||
isUUID(token.split(".")[1]));
|
||||
$: isEndpointValid = isURL(api_endpoint_input);
|
||||
</script>
|
||||
|
||||
@@ -66,22 +68,30 @@
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
axios
|
||||
.request({
|
||||
method: "GET",
|
||||
url: $api_endpoint + "api/stations/me",
|
||||
headers: { Authorization: "Bearer " + token },
|
||||
})
|
||||
.then(function (response) {
|
||||
error = false;
|
||||
errormessage = "";
|
||||
apikey.set(token);
|
||||
stationinfo.set(JSON.stringify(response.data));
|
||||
})
|
||||
.catch(function (e) {
|
||||
error = true;
|
||||
errormessage = e.response.data.short;
|
||||
});
|
||||
if (token === "rst") {
|
||||
apikey.set("");
|
||||
api_endpoint.set("");
|
||||
page.set("");
|
||||
token = "";
|
||||
api_endpoint_input = "";
|
||||
} else {
|
||||
axios
|
||||
.request({
|
||||
method: "GET",
|
||||
url: $api_endpoint + "api/stations/me",
|
||||
headers: { Authorization: "Bearer " + token },
|
||||
})
|
||||
.then(function (response) {
|
||||
error = false;
|
||||
errormessage = "";
|
||||
apikey.set(token);
|
||||
stationinfo.set(JSON.stringify(response.data));
|
||||
})
|
||||
.catch(function (e) {
|
||||
error = true;
|
||||
errormessage = e.response.data.short;
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="flex flex-col pt-4">
|
||||
@@ -117,10 +127,18 @@
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
if (api_endpoint_input.substr(-1) !== "/") {
|
||||
api_endpoint_input = api_endpoint_input + "/";
|
||||
if (api_endpoint_input === "rst") {
|
||||
apikey.set("");
|
||||
api_endpoint.set("");
|
||||
page.set("");
|
||||
token = "";
|
||||
api_endpoint_input = "";
|
||||
} else {
|
||||
if (api_endpoint_input.substr(-1) !== "/") {
|
||||
api_endpoint_input = api_endpoint_input + "/";
|
||||
}
|
||||
api_endpoint.set(api_endpoint_input);
|
||||
}
|
||||
api_endpoint.set(api_endpoint_input);
|
||||
}}
|
||||
>
|
||||
<div class="flex flex-col pt-4">
|
||||
@@ -239,7 +257,7 @@
|
||||
<img
|
||||
alt=""
|
||||
class="object-cover w-full h-screen hidden md:block"
|
||||
src="https://source.unsplash.com/IXUM4cJynP0"
|
||||
src={background}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
BIN
src/kaya_kids_background.jpg
Normal file
BIN
src/kaya_kids_background.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 538 KiB |
Reference in New Issue
Block a user