refactor(chat + workspace): chat和workspace重构,子路由、懒加载等
This commit is contained in:
1 parent
0a647a0b79
commit
1f1f7236b0
57 files changed
+4356
-3798
No files matched your search
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* features/auth/api/user.api.ts
|
||||
* 用户域 HTTP API:资料、请假、密码重置、Agent 列表等。
|
||||
*/
|
||||
import { getAuthHeaders } from '@/utils/auth';
|
||||
import { requestJson } from '@/shared/api/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());
|
||||
|
||||
export const listAgentGuides = (agentId: number) => requestJson<any[]>(`/api/agents/${agentId}/guides`, auth());
|
||||
Reference in new issue
Block a user