Auth: idUsuario login via sige_sam_v3.usuario
- Login uses idUsuario + password (plain text or SHA256) - API types: HelpDeskUser with idUsuario, nombres, apPaterno - Sidebar/layout: fullName from nombres + apPaterno - pnpm-workspace.yaml: approve unrs-resolver builds
This commit is contained in:
1 parent
2a303c73ae
commit
72775500da
7 files changed
+45
-31
No files matched your search
+14
-14
@@ -28,16 +28,15 @@ async function fetchApi<T>(
|
||||
}
|
||||
|
||||
// ==================== Auth ====================
|
||||
// SAM uses RUT-based auth — adapt as needed
|
||||
export async function login(rut: string, password: string) {
|
||||
return fetchApi<{ success: boolean; message?: string; token?: string; user?: User }>(
|
||||
"/api/auth/login",
|
||||
{ method: "POST", body: JSON.stringify({ rut, password }) }
|
||||
export async function login(idUsuario: string, password: string) {
|
||||
return fetchApi<{ success: boolean; message?: string; token?: string; user?: HelpDeskUser }>(
|
||||
"/api/helpdesk/login",
|
||||
{ method: "POST", body: JSON.stringify({ idUsuario, password }) }
|
||||
);
|
||||
}
|
||||
|
||||
export async function getMe() {
|
||||
return fetchApi<User>("/api/auth/me");
|
||||
return fetchApi<HelpDeskUser>("/api/helpdesk/me");
|
||||
}
|
||||
|
||||
// ==================== Tickets ====================
|
||||
@@ -152,15 +151,16 @@ export async function getSLAPolicies() {
|
||||
}
|
||||
|
||||
// ==================== Types ====================
|
||||
export interface User {
|
||||
usuarioId: number;
|
||||
nombre: string;
|
||||
export interface HelpDeskUser {
|
||||
idUsuario: string;
|
||||
nombres: string;
|
||||
apPaterno: string;
|
||||
apMaterno?: string;
|
||||
email: string;
|
||||
perfil: string;
|
||||
sedeId?: number;
|
||||
telefono?: string;
|
||||
tipo?: string;
|
||||
activo: number;
|
||||
fono?: string;
|
||||
idSede?: number;
|
||||
}
|
||||
|
||||
export interface Ticket {
|
||||
@@ -196,7 +196,7 @@ export interface TicketListResult {
|
||||
export interface Comment {
|
||||
id: number;
|
||||
ticketId: number;
|
||||
userId: number;
|
||||
userId: string;
|
||||
userName?: string;
|
||||
content: string;
|
||||
isInternal: boolean;
|
||||
@@ -216,7 +216,7 @@ export interface KBArticle {
|
||||
content: string;
|
||||
categoryId: number;
|
||||
categoryName?: string;
|
||||
authorId: number;
|
||||
authorId: string;
|
||||
authorName?: string;
|
||||
isPublished: boolean;
|
||||
viewCount: number;
|
||||
|
||||
Reference in new issue
Block a user