mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-24 19:31:03 +00:00
getting user profile from api
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user