Adds profile and settings pages
This commit is contained in:
@@ -34,4 +34,15 @@ export const authHandlers = [
|
||||
http.post(`${API_BASE}/api/v1/auth/revoke`, () => {
|
||||
return new HttpResponse(null, { status: 204 });
|
||||
}),
|
||||
|
||||
http.post(`${API_BASE}/api/v1/Auth/change-password`, async ({ request }) => {
|
||||
const body = (await request.json()) as { currentPassword: string; newPassword: string };
|
||||
if (body.currentPassword === TEST_CREDENTIALS.password) {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}
|
||||
return HttpResponse.json(
|
||||
problem(400, 'Incorrect password', 'Current password is incorrect.'),
|
||||
{ status: 400 },
|
||||
);
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -8,4 +8,6 @@ export const availabilityHandlers = [
|
||||
message: '',
|
||||
}),
|
||||
),
|
||||
|
||||
http.post('*/Availability/admin/status', () => new HttpResponse(null, { status: 200 })),
|
||||
];
|
||||
|
||||
@@ -91,6 +91,18 @@ export const userHandlers = [
|
||||
|
||||
http.put(`${API_BASE}/api/v1/Users/:userId/active`, () => new HttpResponse(null, { status: 200 })),
|
||||
|
||||
http.put(`${API_BASE}/api/v1/Users/me`, async ({ request }) => {
|
||||
const body = (await request.json()) as { name: string; email: string };
|
||||
const owner = mockUsers.find((u) => u.role === 'Owner') ?? mockUsers[0];
|
||||
const updated: UserListItem = {
|
||||
...owner,
|
||||
name: body.name,
|
||||
email: body.email,
|
||||
};
|
||||
mockUsers = mockUsers.map((u) => (u.id === owner.id ? updated : u));
|
||||
return HttpResponse.json(updated);
|
||||
}),
|
||||
|
||||
http.delete(`${API_BASE}/api/v1/Users/:userId`, ({ params }) => {
|
||||
const { userId } = params as { userId: string };
|
||||
const ownerUser = mockUsers.find((u) => u.role === 'Owner');
|
||||
|
||||
Reference in New Issue
Block a user