fix(conflicts): Merge branch 'refator' into dev
This commit is contained in:
commit
7f126cfd52
24 files changed
+2314
-4223
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { getAuthHeaders } from '../utils/auth';
|
||||
import { requestJson } from './client';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
|
||||
export const getUserProfile = () => requestJson<Record<string, any>>('/api/user/profile', auth());
|
||||
|
||||
export interface LeaveBalanceResult {
|
||||
has_balance: boolean;
|
||||
leave_type_label: string;
|
||||
year: number;
|
||||
total_hours: number | null;
|
||||
used_hours: number | null;
|
||||
remaining_hours: number | null;
|
||||
}
|
||||
|
||||
export const getLeaveBalance = (leaveType: string) =>
|
||||
requestJson<LeaveBalanceResult>(`/api/user/leave-balance?leave_type=${encodeURIComponent(leaveType)}`, auth());
|
||||
|
||||
export interface LeaveWorkflowSubmitResult {
|
||||
request_id?: string;
|
||||
submitted_at?: string;
|
||||
request_name?: string;
|
||||
}
|
||||
|
||||
export const submitLeaveWorkflow = (form: Record<string, any>) =>
|
||||
requestJson<LeaveWorkflowSubmitResult>('/api/user/leave-workflow/submit', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(form),
|
||||
});
|
||||
|
||||
export const resetPasswordConfirm = (token: string, newPassword: string) =>
|
||||
requestJson('/api/user/reset-password-confirm', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ token, new_password: newPassword }),
|
||||
});
|
||||
|
||||
export const getUserAgent = (agentId: number) =>
|
||||
requestJson<Record<string, any>>(`/api/user/agents/${agentId}`, auth());
|
||||
|
||||
export const listUserAgents = () => requestJson<any[]>('/api/agents', auth());
|
||||
Reference in new issue
Block a user