kontenhumas-fe/service/client/client-profile.ts

63 lines
1.5 KiB
TypeScript

import { getCookiesDecrypt } from "@/lib/utils";
import {
httpGetInterceptor,
httpPutInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
// Types untuk Client Profile
export interface ClientProfile {
id: string;
name: string;
description: string | null;
clientType: string;
parentClientId: string | null;
logoUrl: string | null;
logoImagePath: string | null;
address: string | null;
phoneNumber: string | null;
website: string | null;
subClientCount: number;
maxUsers: number | null;
maxStorage: number | null;
currentUsers: number;
currentStorage: number | null;
settings: any | null;
createdById: string | null;
isActive: boolean;
createdAt: string;
updatedAt: string;
}
export interface UpdateClientProfileRequest {
name: string;
description?: string;
address?: string;
phoneNumber?: string;
website?: string;
}
// Service functions
export async function getClientProfile() {
const url = "/clients/profile";
return httpGetInterceptor(url);
}
export async function updateClientProfile(data: UpdateClientProfileRequest) {
const url = "/clients/update";
return httpPutInterceptor(url, data);
}
export async function uploadClientLogo(logoFile: File) {
const url = "/clients/logo";
const formData = new FormData();
formData.append("logo", logoFile);
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, formData, headers);
}