fix(refactor): add services/adapters/useCases
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {get, post, put, remove} from './apiHelpers.js'
|
||||
import {convertList} from '@helpers/adapter/adapter.js'
|
||||
import {convertList, convertObject} from '@helpers/adapter/adapter.js'
|
||||
|
||||
const config = {
|
||||
id: "id",
|
||||
@@ -46,7 +46,7 @@ class Services {
|
||||
async createService(payload) {
|
||||
let newService = []
|
||||
const updatedPort = parseFloat(payload.port)
|
||||
const updatedService = {...convertObject(payload, {config: servConfig}), port: updatedPort}
|
||||
const updatedService = {...convertObject(payload, {config: this.config}), port: updatedPort}
|
||||
await post(`${this.apiAddr}/servers`, updatedService).then(res => {
|
||||
newService = convertObject(res.value, {config: this.config})
|
||||
}).catch(err => {
|
||||
@@ -64,7 +64,7 @@ class Services {
|
||||
async updateService(payload) {
|
||||
let resService = []
|
||||
const updatedPort = parseFloat(payload.port)
|
||||
const updatedService = {...convertObject(payload, {config: servConfig}), port: updatedPort}
|
||||
const updatedService = {...convertObject(payload, {config: this.config}), port: updatedPort}
|
||||
if (payload.id) {
|
||||
await put(`${this.apiAddr}/servers`, updatedService, payload.id).then(res => {
|
||||
resService = convertObject(res.value, {config: this.config})
|
||||
|
||||
Reference in New Issue
Block a user