refactoring magic strings: User API URLs in user-management view

This commit is contained in:
2025-09-30 08:22:56 +02:00
parent 50a9286895
commit e1694552c9
2 changed files with 9 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import Button from '$lib/components/Button.svelte';
import { API_ROUTES } from '../../index.js';
const { data } = $props();
@@ -20,7 +21,7 @@
});
async function getUsers() {
const URL = '/api/users';
const URL = API_ROUTES.USERS;
try {
const response = await fetch(URL);
@@ -42,7 +43,7 @@
return;
}
const URL = '/api/users';
const URL = API_ROUTES.USERS;
const userData = { userName: userName, userPassword: userPassword };
try {
@@ -78,7 +79,7 @@
}
async function deleteUser(userId: string) {
const URL = `/api/users/${userId}`;
const URL = API_ROUTES.USER(userId);
try {
const response = await fetch(URL, {