f090_magic_strings_refactoring #35

Merged
jared merged 29 commits from f090_magic_strings_refactoring into development 2025-09-30 13:33:27 +02:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit c93a5c50de - Show all commits

View File

@@ -12,7 +12,7 @@
import { invalidateAll } from '$app/navigation';
import NameItemEditor from '$lib/components/NameItemEditor.svelte';
import EmptyList from '$lib/components/EmptyList.svelte';
import { ROUTE_NAMES } from '../../../index.js';
import { API_ROUTES, ROUTE_NAMES } from '../../../index.js';
//Seite für die Tatort-Liste
let { data } = $props();
@@ -45,7 +45,7 @@
inProgress = true;
isError = false;
try {
const res = await fetch(`/api/list/${vorgangToken}/${oldName}`, {
const res = await fetch(API_ROUTES.CRIME(vorgangToken, oldName), {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
@@ -71,11 +71,10 @@
open = true;
inProgress = true;
isError = false;
let path = new URL(data.url).pathname;
path += `/${tatort}`;
let path = API_ROUTES.CRIME(vorgangToken, tatort)
try {
const res = await fetch(`/api${path}`, {
const res = await fetch(path, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
@@ -147,7 +146,7 @@ Mit freundlichen Grüßen,
data-testid="crime-link"
href="{ROUTE_NAMES.CRIME(vorgangToken, item.name, vorgangPIN)}"
class=" flex justify-between gap-x-6 py-5"
aria-label="/view/{vorgangToken}/{item.name}?pin={vorgangPIN}"
aria-label="{ROUTE_NAMES.CRIME(vorgangToken, item.name, vorgangPIN)}"
title={item.name}
>
<Cube />

View File

@@ -35,6 +35,9 @@ export const API_ROUTES = {
VORGANG_NAME_EXIST: (vorgangName: string) => `/api/list/${vorgangName}`,
VORGANG_PIN: (vorgangName: string) => `/api/vorgang/${vorgangName}/vorgangPIN`,
// Tatort
CRIME: (vorgangToken: string, crimeName: string) => `/api/list/${vorgangToken}/${crimeName}`,
// Users
USERS: '/api/users',
USER: (userId: string) => `/api/users/${userId}`