small changes, login first version
small changes: - Title changed -> ESP - Express, Share, Post - Icon changed -> Logo login: connection to api :)
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/png" href="src/assets/esp-logo_no_text.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + Vue + TS</title>
|
<title>ESP - Express, Share, Post</title>
|
||||||
<link rel="stylesheet" href="/src/assets/main.css" />
|
<link rel="stylesheet" href="/src/assets/main.css" />
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-hintergrund-farbe">
|
<body class="bg-hintergrund-farbe">
|
||||||
|
|||||||
@@ -1,9 +1,40 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import router from "../../router";
|
import router from "../../router";
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
function login() {
|
async function login() {
|
||||||
// alert("Account deleted. You will be redirected to the login page.");
|
|
||||||
router.push("/");
|
const username = ref('testuser');
|
||||||
|
const password = ref('testpassword');
|
||||||
|
|
||||||
|
|
||||||
|
const response = await fetch('http://localhost:8000/api/account/login', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ username: username.value, password: password.value }),
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Fehler beim Login: ${response.status} - ${response.statusText}`);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
// Handle successful login (e.g., store user data in Vuex)
|
||||||
|
console.log(response);
|
||||||
|
/*
|
||||||
|
console.log('Erfolgreich eingeloggt:', data);
|
||||||
|
|
||||||
|
console.error('Fehler beim Login:', error);
|
||||||
|
|
||||||
|
*/
|
||||||
|
// Handle login error (e.g., display an error message to the user)
|
||||||
|
|
||||||
|
|
||||||
|
alert("Logged in. You will be redirected to the login page.");
|
||||||
|
router.push('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmit(event: Event) {
|
function handleSubmit(event: Event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user