mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
added changing password frontend backend
This commit is contained in:
@@ -117,6 +117,19 @@ export class EmployeeService {
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
async changePassword(id: string, data: { currentPassword: string, newPassword: string }): Promise<void> {
|
||||
const response = await fetch(`${API_BASE_URL}/employees/${id}/password`, {
|
||||
method: 'PUT',
|
||||
headers: getAuthHeaders(),
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json();
|
||||
throw new Error(error.error || 'Failed to change password');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const employeeService = new EmployeeService();
|
||||
@@ -138,14 +138,14 @@ export const shiftPlanService = {
|
||||
},
|
||||
|
||||
// Create plan from template
|
||||
createFromTemplate: async (data: CreateShiftFromTemplateRequest): Promise<ShiftPlan> => {
|
||||
/*createFromTemplate: async (data: CreateShiftFromTemplateRequest): Promise<ShiftPlan> => {
|
||||
const response = await fetch(`${API_BASE}/from-template`, {
|
||||
method: 'POST',
|
||||
headers: getAuthHeaders(),
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return handleResponse(response);
|
||||
},
|
||||
},*/
|
||||
|
||||
// Create new plan
|
||||
createPlan: async (data: CreateShiftPlanRequest): Promise<ShiftPlan> => {
|
||||
|
||||
Reference in New Issue
Block a user