feat(worker): login-only client (admin creates users)

This commit is contained in:
Bas van Rossem
2026-06-17 17:53:20 +02:00
parent bd2d859e92
commit 7d200eb8fc
3 changed files with 8 additions and 50 deletions

View File

@@ -5,7 +5,7 @@ export const API_URL = import.meta.env.VITE_API_URL ?? 'http://localhost:3000';
export class ApiError extends Error {
constructor(
public status: number,
message: string,
message: string
) {
super(message);
this.name = 'ApiError';
@@ -35,13 +35,3 @@ export async function signIn(email: string, password: string): Promise<void> {
if (!token) throw new ApiError(500, 'Geen token ontvangen');
setToken(token);
}
// Sign up affordance for testing: POST /api/auth/sign-up/email.
export async function signUp(email: string, password: string): Promise<void> {
const res = await fetch(`${API_URL}/api/auth/sign-up/email`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password, name: email.split('@')[0] || 'Worker' }),
});
if (!res.ok) throw new ApiError(res.status, 'Registreren mislukt');
}