CoolFace
Apppublic

DataScope26/WEB

sourceHugging Faceupdated 7d agoView on Hugging Face
0likes
apiCompanies.js92 linesDownload Raw Back to services
1import axiosClient from "./axiosClient.js";2 3export const uploadCompanyLogo = async (token, companyId, file) => {4    try {5        const formData = new FormData();6        formData.append("image", file);7        formData.append("companyId", companyId);8 9        const response = await axiosClient.patch(10            `/company/logo`,11            formData,12            {13                headers: {14                    Authorization: token,15                }16            }17        );18 19        return response.data;20    } catch (error) {21        throw error;22    }23};24 25export const createCompany = async (token, companyName, companyTier) => {26 27    try {28        const response = await axiosClient.put(29            "/company",30            {31                companyName: companyName,32                companyTier: companyTier,33            },34            {35                headers: {36                    Authorization: token,37                },38                params: {39                    companyName: companyName,40                    companyTier: companyTier,41                }42            }43        );44 45        return response.data;46    } catch (error) {47        throw error;48    }49};50 51export const patchCompany = async (token, companyId, data) => {52    //routes.patch('/company', authentication, adminAuth, patchCompany)53    try {54        const response = await axiosClient.patch(55            "/company",56            {57                companyId: companyId,58                ...data59            },60            {61                headers: {62                    Authorization: token,63                }64            }65        );66 67        return response.data;68    } catch (error) {69        throw error;70    }71}72 73export const deleteCompany = async (token, companyId) => {74    //routes.delete('/company', authentication, adminAuth, deleteCompany)75    try {76        const response = await axiosClient.delete(77            "/company",78            {79                headers: {80                    Authorization: token,81                },82                data: {83                    companyId: companyId84                }85            }86        );87 88        return response.data;89    } catch (error) {90        throw error;91    }92}