CoolFace
Apppublic

DataScope26/WEB

sourceHugging Faceupdated 7d agoView on Hugging Face
0likes
apiAuth.js112 linesDownload Raw Back to services
1import axiosClient from "./axiosClient.js";2import { requestWaitlistSignup } from "./apiWaitlist.js";3 4export const userDelete = async (token) => {5     try {6        const response = await axiosClient.delete("/user", {7            headers: { Authorization: token }8        })9        return response10    } catch (error) {11        throw error12    }13}14 15export const userLogin = async (email, password) => {16    try {17        const response = await axiosClient.post("/login", {18            "email": email,19            "password": password20        });21        return response22    } catch (error) {23        throw error24    }25};26 27export const userSignup = async (name, email, password, linkedin = "") => {28    try {29        return await requestWaitlistSignup(name, email, password, linkedin);30    } catch (error) {31        throw error;32    }33};34 35export const employeeRegister = async (name, password, token) => {36    try {37        const response = await axiosClient.post("/employee/register", {38            "name": name,39            "password": password,40            "token": token41        });42        return response43    } catch (error) {44        throw error45    }46};47 48export const getUserData = async (token) => {49    try {50        const response = await axiosClient.get("/userdata", {51            headers: { Authorization: token }52        })53        return response54    } catch (error) {55        throw error56    }57}58 59export const patchUserProfilePic = async (token, image) => {60    try {61        const response = await axiosClient.patch("/user/pfp", image, {62            headers: { Authorization: token }63        });64        return response65    } catch (error) {66        throw error67    }68}69 70export const patchUser = async (token, data) => {71    try {72        const response = await axiosClient.patch("/user", data, {73            headers: { Authorization: token }74        })75        return response76    } catch (error) {77        throw error78    }79}80 81export const getMyCompanies = async (token) => {82    try {83        const response = await axiosClient.get("/mycompanies", {84            headers: { Authorization: token }85        })86        return response87    } catch (error) {88        throw error89    }90}91 92export const patchChangePassword = async (token, data) => {93    try {94        const response = await axiosClient.patch("/user/change-password", data, {95            headers: { Authorization: token }96        });97        return response;98    } catch (error) {99        throw error;100    }101}102 103export const patchChangeEmail = async (token, data) => {104    try {105        const response = await axiosClient.patch("/user/change-email", data, {106            headers: { Authorization: token }107        });108        return response;109    } catch (error) {110        throw error;111    }112}