misc_pterodactyl-panel/resources/scripts/api/admin/user.ts

17 lines
609 B
TypeScript
Raw Normal View History

import http, { QueryBuilderParams, withQueryBuilderParams } from '@/api/http';
2022-02-27 16:40:51 +00:00
import { Transformers, User } from '@definitions/admin';
export const getUser = async (id: string | number): Promise<User> => {
const { data } = await http.get(`/api/application/users/${id}`);
return Transformers.toUser(data.data);
};
export const searchUserAccounts = async (params: QueryBuilderParams<'username' | 'email'>): Promise<User[]> => {
const { data } = await http.get('/api/application/users', {
params: withQueryBuilderParams(params),
});
return data.data.map(Transformers.toUser);
};