mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-14 21:21:56 +03:00
6a041b6f6d
cleaning old code to introduce better patern # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
31 lines
806 B
TypeScript
31 lines
806 B
TypeScript
import { AxiosInstance } from "axios";
|
|
import { UUID } from "crypto";
|
|
|
|
import { UserStats } from "@/lib/types/User";
|
|
|
|
export type UserIdentityUpdatableProperties = {
|
|
empty?: string | null;
|
|
};
|
|
|
|
export type UserIdentity = {
|
|
user_id: UUID;
|
|
};
|
|
|
|
export const updateUserIdentity = async (
|
|
userUpdatableProperties: UserIdentityUpdatableProperties,
|
|
axiosInstance: AxiosInstance
|
|
): Promise<UserIdentity> =>
|
|
axiosInstance.put(`/user/identity`, userUpdatableProperties);
|
|
|
|
export const getUserIdentity = async (
|
|
axiosInstance: AxiosInstance
|
|
): Promise<UserIdentity> => {
|
|
const { data } = await axiosInstance.get<UserIdentity>(`/user/identity`);
|
|
|
|
return data;
|
|
};
|
|
|
|
export const getUser = async (
|
|
axiosInstance: AxiosInstance
|
|
): Promise<UserStats> => (await axiosInstance.get<UserStats>("/user")).data;
|