diff --git a/src/pages/index.vue b/src/pages/index.vue
index aaafffd..03ec09c 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -2,31 +2,53 @@
@@ -36,29 +58,31 @@ export default {
methods: {
login: async function (e) {
const config = useRuntimeConfig();
- e.preventDefault()
- document.getElementById("password-incorrect").classList.add("hidden")
+ e.preventDefault();
+ document.getElementById("password-incorrect").classList.add("hidden");
let username = document.getElementById("username").value;
let password = document.getElementById("password").value;
- let response = await fetch(`${config.public.apiURL}/auth/login`, {
+ let response = await fetch(`${config.public.apiURL}/auth/login/`, {
method: "POST",
- body: JSON.stringify({username: username, password: password}),
- headers: {"Content-type": "application/json"}
+ body: JSON.stringify({ username: username, password: password }),
+ headers: { "Content-type": "application/json" },
})
- .then(response => {
- if (!response.ok) {
- document.getElementById("password-incorrect").classList.remove("hidden")
- return false;
- }
+ .then((response) => {
+ if (!response.ok) {
+ document
+ .getElementById("password-incorrect")
+ .classList.remove("hidden");
+ return false;
+ }
- return response.json();
+ return response.json();
- //window.location = "/admin"
- })
- .catch(err => {
- return false
- })
+ //window.location = "/admin"
+ })
+ .catch((err) => {
+ return false;
+ });
if (response) {
let token = useCookie("token", {
@@ -66,19 +90,17 @@ export default {
});
token.value = response.token;
- return navigateTo("/admin")
+ return navigateTo("/admin");
}
- }
+ },
},
mounted() {
let token = useCookie("token");
if (token.value) {
- navigateTo("/admin")
+ navigateTo("/admin");
}
- }
-}
+ },
+};
-
\ No newline at end of file
+