feat(worker): login-only client (admin creates users)
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user