mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-23 17:42:33 +01:00
14 lines
610 B
TypeScript
14 lines
610 B
TypeScript
import { rawDataToServerObject, Server } from '@/api/server/getServer';
|
|
import http, { getPaginationSet, PaginatedResult } from '@/api/http';
|
|
|
|
export default (query?: string): Promise<PaginatedResult<Server>> => {
|
|
return new Promise((resolve, reject) => {
|
|
http.get(`/api/client`, { params: { include: [ 'allocation' ], query } })
|
|
.then(({ data }) => resolve({
|
|
items: (data.data || []).map((datum: any) => rawDataToServerObject(datum.attributes)),
|
|
pagination: getPaginationSet(data.meta.pagination),
|
|
}))
|
|
.catch(reject);
|
|
});
|
|
};
|