This commit is contained in:
pradeepkumar
2026-01-24 21:06:13 +05:30
parent 0f84e3d4d7
commit eba83e2961
9 changed files with 585 additions and 26 deletions

View File

@@ -43,6 +43,31 @@ interface ApiResponse<T> {
message?: string;
}
export interface FieldValueInput {
fieldSlug: string;
value: string | number | boolean | string[] | Record<string, unknown> | null;
}
export interface FieldValueResponse {
fieldSlug: string;
fieldName: string;
fieldType: string;
sectionSlug: string;
sectionName: string;
value: unknown;
}
export interface GetFieldValuesResponse {
agentProfileId: string;
fieldValues: FieldValueResponse[];
}
export interface SaveFieldValuesResponse {
message: string;
savedCount: number;
data: unknown[];
}
// Agents Service for Web
class AgentsService {
private basePath = '/agents';
@@ -61,6 +86,21 @@ class AgentsService {
const response = await api.put<ApiResponse<AgentProfile>>(`${this.basePath}/profile`, data);
return response.data.data;
}
async saveFieldValues(fieldValues: FieldValueInput[]): Promise<SaveFieldValuesResponse> {
const response = await api.put<ApiResponse<SaveFieldValuesResponse>>(
`${this.basePath}/profile/field-values`,
{ fieldValues }
);
return response.data.data;
}
async getFieldValues(): Promise<GetFieldValuesResponse> {
const response = await api.get<ApiResponse<GetFieldValuesResponse>>(
`${this.basePath}/profile/field-values`
);
return response.data.data;
}
}
export const agentsService = new AgentsService();