diff --git a/src/lib/api/getAll.ts b/src/lib/api/getAll.ts new file mode 100644 index 0000000..8c098a0 --- /dev/null +++ b/src/lib/api/getAll.ts @@ -0,0 +1,24 @@ +export async function getAllUsers(token: string) { + try { + const response = await fetch( + 'https://sucu-backend-2024-689509857491.asia-southeast1.run.app/api/v1/users', + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + } + } + ); + + if (!response.ok) { + const errorData = await response.json(); + throw new Error(`Error: ${errorData.message}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error('Failed to fetch users:', error); + } +} diff --git a/src/lib/components/Pagination/Pagination.svelte b/src/lib/components/Pagination/Pagination.svelte index 263838e..ff87a5f 100644 --- a/src/lib/components/Pagination/Pagination.svelte +++ b/src/lib/components/Pagination/Pagination.svelte @@ -1,4 +1,5 @@ -
{subtitle}
+