Fixed login request
This commit is contained in:
parent
0aab082b17
commit
fe43a2212a
|
@ -46,10 +46,9 @@ export default class Apiclient {
|
||||||
|
|
||||||
static async login(username, password) {
|
static async login(username, password) {
|
||||||
return (
|
return (
|
||||||
await axios.post(`https://kauft.es/api/auth/login`, {
|
await axios.post(`https://kauft.es/api/auth/login`, {}, {
|
||||||
auth: {
|
auth: {
|
||||||
username,
|
username, password
|
||||||
password
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
|
|
@ -5,7 +5,9 @@ import Apiclient from '$lib/Apiclient';
|
||||||
|
|
||||||
$: username = "";
|
$: username = "";
|
||||||
$: password = "";
|
$: password = "";
|
||||||
|
$: error = "";
|
||||||
|
|
||||||
|
UserStore.init();
|
||||||
async function login() {
|
async function login() {
|
||||||
let login = await Apiclient.login(username, password);
|
let login = await Apiclient.login(username, password);
|
||||||
if (login.status != 200 && login.status != 201) {
|
if (login.status != 200 && login.status != 201) {
|
||||||
|
@ -27,14 +29,13 @@ import Apiclient from '$lib/Apiclient';
|
||||||
|
|
||||||
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">Please login</p>
|
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">Please login</p>
|
||||||
|
|
||||||
<form>
|
|
||||||
<div class="w-full mt-4">
|
<div class="w-full mt-4">
|
||||||
<input
|
<input
|
||||||
class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
|
class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
aria-label="Username"
|
aria-label="Username"
|
||||||
value={username}
|
bind:value={username}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ import Apiclient from '$lib/Apiclient';
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
aria-label="Password"
|
aria-label="Password"
|
||||||
value={password}
|
bind:value={password}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -56,6 +57,5 @@ import Apiclient from '$lib/Apiclient';
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,7 +0,0 @@
|
||||||
<script>
|
|
||||||
import '../../app.postcss';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="bg-white dark:bg-gray-800 h-screen">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
Loading…
Reference in New Issue