f090_magic_strings_refactoring #35
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Button from '$lib/components/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
|
import { API_ROUTES } from '../../index.js';
|
||||||
|
|
||||||
const { data } = $props();
|
const { data } = $props();
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function getUsers() {
|
async function getUsers() {
|
||||||
const URL = '/api/users';
|
const URL = API_ROUTES.USERS;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(URL);
|
const response = await fetch(URL);
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const URL = '/api/users';
|
const URL = API_ROUTES.USERS;
|
||||||
const userData = { userName: userName, userPassword: userPassword };
|
const userData = { userName: userName, userPassword: userPassword };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -78,7 +79,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function deleteUser(userId: string) {
|
async function deleteUser(userId: string) {
|
||||||
const URL = `/api/users/${userId}`;
|
const URL = API_ROUTES.USER(userId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(URL, {
|
const response = await fetch(URL, {
|
||||||
|
|||||||
@@ -32,5 +32,9 @@ export const API_ROUTES = {
|
|||||||
VORGANG: (vorgangToken: string) => `/api/list/${vorgangToken}`,
|
VORGANG: (vorgangToken: string) => `/api/list/${vorgangToken}`,
|
||||||
// via `HEAD` method
|
// via `HEAD` method
|
||||||
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`,
|
||||||
|
|
||||||
|
// Users
|
||||||
|
USERS: '/api/users',
|
||||||
|
USER: (userId: string) => `/api/users/${userId}`
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user