getting user profile from api

This commit is contained in:
Zamitto
2024-06-11 23:05:05 -03:00
parent a974141360
commit b8895afc0a
8 changed files with 57 additions and 14 deletions

View File

@@ -1,17 +1,15 @@
import axios from "axios";
import { registerEvent } from "../register-event";
import { userProfileSchema } from "../helpers/validators";
import { logger } from "@main/services";
import { HydraApi } from "@main/services/hydra-api";
const getUserProfile = async (
_event: Electron.IpcMainInvokeEvent,
username: string
) => {
return axios
.get(`${process.env.API_URL}/profile/${username}`)
return HydraApi.get(`/profile/${username}`)
.then((response) => {
const profile = userProfileSchema.parse(response.data);
console.log(profile);
return profile;
})
.catch((err) => {
@@ -20,4 +18,4 @@ const getUserProfile = async (
});
};
registerEvent("getUserProfiel", getUserProfile);
registerEvent("getUserProfile", getUserProfile);