mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-04 13:25:47 -05:00
ui(admin): add allocation table, implement allocation creator
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import http from '@/api/http';
|
||||
import { Allocation, rawDataToAllocation } from '@/api/admin/nodes/allocations/getAllocations';
|
||||
|
||||
export interface Values {
|
||||
ip: string;
|
||||
ports: number[];
|
||||
alias?: string;
|
||||
}
|
||||
|
||||
export default (id: string | number, values: Values, include: string[] = []): Promise<Allocation[]> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post(`/api/application/nodes/${id}/allocations`, values, { params: { include: include.join(',') } })
|
||||
.then(({ data }) => resolve((data || []).map(rawDataToAllocation)))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user