mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 05:43:45 +02:00
Improve logic handle auto-allocation of ports for a server
This commit is contained in:
@@ -2,10 +2,8 @@ import { Allocation } from '@/api/server/getServer';
|
||||
import http from '@/api/http';
|
||||
import { rawDataToServerAllocation } from '@/api/transformers';
|
||||
|
||||
export default (uuid: string): Promise<Allocation> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get(`/api/client/servers/${uuid}/network/allocations/new`)
|
||||
.then(({ data }) => resolve(rawDataToServerAllocation(data)))
|
||||
.catch(reject);
|
||||
});
|
||||
export default async (uuid: string): Promise<Allocation> => {
|
||||
const { data } = await http.post(`/api/client/servers/${uuid}/network/allocations`);
|
||||
|
||||
return rawDataToServerAllocation(data);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user