code cleanup

This commit is contained in:
2025-07-30 15:35:19 +02:00
parent 631a527a5d
commit fccec9865a
27 changed files with 442 additions and 428 deletions

View File

@@ -1,19 +1,21 @@
<script>
import { onMount } from 'svelte';
import { t } from '../../translations.svelte.js';
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
let mail = "";
let caption = t('send_mail');
let error = null;
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
let caption = t('send_mail');
let error = null;
let mail = "";
const router = useTinyRouter();
async function submit(ev){
ev.preventDefault();
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/reset_pw`;
const url = api(`user/reset_pw`);
const resp = await fetch(url,{
method : 'POST',
body : mail
body : mail
});
if (resp.ok) {
caption = t('data_sent');
@@ -24,9 +26,9 @@
async function checkToken(){
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
const token = urlParams.get('token');
if (token) {
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/validate/${token}`;
const url = api(`user/validate/${token}`);
const resp = await fetch(url,{
credentials: 'include'
});
@@ -46,13 +48,13 @@
<style>
label{display:block}
fieldset{
display: block;
position: relative;
left: 50%;
width: 200px;
margin-left: -100px;
margin-bottom: 30px;
text-align: center;
display : block;
position : relative;
left : 50%;
width : 200px;
margin-left : -100px;
margin-bottom : 30px;
text-align : center;
}
</style>