Improve logic handle auto-allocation of ports for a server
This commit is contained in:
parent
7638ffccde
commit
c6bd7ff661
10 changed files with 201 additions and 79 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue