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

View File

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