fix(refactor): add services/adapters/useCases

This commit is contained in:
2024-03-06 14:09:55 +03:00
parent 4b6cda8632
commit 08439ef477
5 changed files with 6 additions and 8 deletions

View File

@@ -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})