deleting individual fuels and terminals work
This commit is contained in:
parent
b3ac795200
commit
776efdd2ad
|
@ -23,10 +23,7 @@ export function updateProduct(data) {
|
||||||
|
|
||||||
export function deleteProduct(data) {
|
export function deleteProduct(data) {
|
||||||
if (data !== '') {
|
if (data !== '') {
|
||||||
console.log(data)
|
return axios.delete(`${ProductEndpointUrl}/fuels/${data}?secret=MySecretForFuels&platform=${store.state.platform}`)
|
||||||
const chad = `${ProductEndpointUrl}/fuels/${data}?secret=MySecretForFuels&platform=${store.state.platform}`
|
|
||||||
// return axios.delete(${ProductEndpointUrl}/fuels/${data}?secret=MySecretForFuels&platform=${store.state.platform})
|
|
||||||
return chad
|
|
||||||
}
|
}
|
||||||
return 'error'
|
return 'error'
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,8 @@ export function updateTerminal(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteTerminal(data) {
|
export function deleteTerminal(data) {
|
||||||
// put this logic in the .vue file
|
|
||||||
if (data !== '') {
|
if (data !== '') {
|
||||||
console.log(data)
|
return axios.delete(`${TerminalEndpointUrl}/terminal/${data}?secret=MySecretForTerminals&platform=${store.state.platform}`)
|
||||||
const chad = `${TerminalEndpointUrl}/terminal/${data}?secret=MySecretForTerminal&platform=${store.state.platform}`
|
|
||||||
// return axios.delete(${ProductEndpointUrl}/fuels/${data}?secret=MySecretForTermina&platform=${store.state.platform})
|
|
||||||
return chad
|
|
||||||
}
|
}
|
||||||
return 'error'
|
return 'error'
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,30 +98,36 @@ export default {
|
||||||
return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
|
return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
|
||||||
},
|
},
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
console.log(this.item._id)
|
|
||||||
if (this.type === 'terminal') {
|
if (this.type === 'terminal') {
|
||||||
console.log(deleteTerminal(this.item._id))
|
deleteTerminal(this.item._id).then((response) => {
|
||||||
} else {
|
this.confirmationPage(response)
|
||||||
console.log(deleteProduct(this.item._id))
|
})
|
||||||
|
} else if (this.type === 'product') {
|
||||||
|
deleteProduct(this.item._id).then((response) => {
|
||||||
|
this.confirmationPage(response)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// delete${this.type}(this.item._id))
|
// delete${this.type}(this.item._id))
|
||||||
// .then((r) => {
|
// .then((r) => {
|
||||||
// console.log(r)
|
// console.log(r)
|
||||||
|
// confirmationPage (response)
|
||||||
// })
|
// })
|
||||||
|
},
|
||||||
|
confirmationPage(response) {
|
||||||
this.viewState = 'confirmation'
|
this.viewState = 'confirmation'
|
||||||
// if (response && response.success){
|
if (response && response.data.message === 'Completed') {
|
||||||
this.confirmation = {
|
this.confirmation = {
|
||||||
text: `Succesfully deleted ${this.item.name} form ${this.type}s list`,
|
text: `Succesfully deleted ${this.item.name} form ${this.type}s list`,
|
||||||
icon: 'el-icon-circle-check',
|
icon: 'el-icon-circle-check',
|
||||||
iconStyle: 'font-size: 75px; color: green;'
|
iconStyle: 'font-size: 75px; color: green;'
|
||||||
|
}
|
||||||
|
} else if (!response || response === 'error') {
|
||||||
|
this.confirmation = {
|
||||||
|
text: `Error deleting ${this.item.name} form ${this.type}s list. Please refresh your page and try again. If the Error persists, please contact dev team`,
|
||||||
|
icon: 'el-icon-circle-close',
|
||||||
|
iconStyle: 'font-size: 75px; color: red;'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// }else if (!response || !response.success){
|
|
||||||
// this.confirmation = {
|
|
||||||
// text: `Error deleting ${this.item.name} form ${this.type}s list. /n Please refresh your page and try again. If the Error persists, please contact Chadmin`,
|
|
||||||
// icon: 'el-icon-circle-close',
|
|
||||||
// iconStyle: 'font-size: 75px; color: red;'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
:item="scope.row"
|
:item="scope.row"
|
||||||
:type="'product'"
|
:type="'product'"
|
||||||
/>
|
/>
|
||||||
|
<!-- NEED TO SEND BACK SUCCESSFULLY DELETED from above SO IT REFETCHES THE PRODUCT LIST -->
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
Loading…
Reference in New Issue