feat: Implement user detail page with agent type management and navigation from the user list.
This commit is contained in:
@@ -1,12 +1,34 @@
|
||||
import api, { ApiResponse } from './api';
|
||||
|
||||
// Types
|
||||
export interface AgentType {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface AgentProfileDetails {
|
||||
id: string;
|
||||
slug: string;
|
||||
bio?: string | null;
|
||||
headline?: string | null;
|
||||
companyName?: string | null;
|
||||
licenseNumber?: string | null;
|
||||
yearsOfExperience?: number | null;
|
||||
isProfileComplete: boolean;
|
||||
profileCompleteness: number;
|
||||
agentTypeId?: string | null;
|
||||
agentType?: AgentType | null;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
role: string;
|
||||
status: string;
|
||||
emailVerified: boolean;
|
||||
emailVerifiedAt?: string | null;
|
||||
authProvider: string;
|
||||
createdAt: string;
|
||||
lastLoginAt: string | null;
|
||||
@@ -19,6 +41,7 @@ export interface User {
|
||||
state: string | null;
|
||||
country: string | null;
|
||||
} | null;
|
||||
agentProfile?: AgentProfileDetails | null;
|
||||
}
|
||||
|
||||
export interface UsersListResponse {
|
||||
@@ -74,6 +97,11 @@ class UsersService {
|
||||
const response = await api.patch<ApiResponse<User>>(`${this.basePath}/${id}/status`, { status });
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
async updateAgentType(userId: string, agentTypeId: string): Promise<{ id: string; agentTypeId: string; agentType: AgentType; message: string }> {
|
||||
const response = await api.patch<ApiResponse<{ id: string; agentTypeId: string; agentType: AgentType; message: string }>>(`${this.basePath}/${userId}/agent-type`, { agentTypeId });
|
||||
return response.data.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const usersService = new UsersService();
|
||||
|
||||
Reference in New Issue
Block a user