Skip to content

Commit

Permalink
PB-1318 : started work on routines to delete KML using service-kml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami Nouidri committed Jan 28, 2025
1 parent 1658eeb commit 26e23eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
14 changes: 14 additions & 0 deletions $
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PB-1327: changed approach to adapting refactored values in cypress tests.


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch bug_PB-1327-categories-translation-issue
# Your branch is up to date with 'origin/bug_PB-1327-categories-translation-issue'.
#
# Changes to be committed:
# modified: src/utils/components/DropdownButton.vue
# modified: tests/cypress/tests-e2e/drawing.cy.js
# modified: tests/cypress/tests-e2e/reportProblem.cy.js
#
23 changes: 22 additions & 1 deletion src/api/files.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class KmlMetadata {
}
}

const kmlBaseUrl = `${getServiceKmlBaseUrl()}api/kml/`
const kmlBaseUrl = `${getServiceKmlBaseUrl()}`

function validateId(id, reject) {
if (!id) {
Expand Down Expand Up @@ -183,6 +183,27 @@ export const updateKml = (id, adminId, kml) => {
})
}

export const deleteKMl = (id) => {
return new Promise((resolve, reject) => {
validateId(id, reject)
axios
.delete(`${kmlBaseUrl}admin/${id}`)
.then((response) => {
if (response.status === 200 && response.data.id) {
resolve()
} else {
const msg = `Incorrect response while deleting file with id=${id}`
log.error(msg, response)
reject(msg)
}
})
.catch((error) => {
log.error(`Error while deleting file with id=${id}`, error)
reject(error)
})
})
}

const _getKml = async (url, resolve, reject) => {
try {
const response = await axios.get(url)
Expand Down

0 comments on commit 26e23eb

Please sign in to comment.