deletion button api modification

This commit is contained in:
sumedh
2024-10-04 20:32:57 +05:30
parent 28d4ac1184
commit bda76abaf9

View File

@@ -31,7 +31,7 @@ const fectchDetails = async () => {
}
}
const ingesttext = (textDetails) => {
const deleteRecords = (textDetails) => {
confirm.require({
target: event.currentTarget,
message: "Do you want to Proceed?",
@@ -42,19 +42,19 @@ const ingesttext = (textDetails) => {
outlined: true
},
acceptProps: {
label: 'Ingest Record',
label: 'Delete Records',
severity: 'danger',
},
accept: () => {
axios.get(`/ingest_texts/${textDetails.id}`)
axios.delete(`/deleteTextRecords/${textDetails.id}`)
.then((response) => {
toast.add({ severity: 'success', summary: 'Ingestion Summary', detail: 'Ingestion Done', life: 6000 });
console.log("inhgestion info: ", response.data)
toast.add({ severity: 'success', summary: 'Ingestion Summary', detail: 'Deletion IN Progress', life: 6000 });
console.log("Deletion info: ", response.data)
})
.catch((error) => {
console.error('Error while ingestion', error)
toast.add({ severity: 'error', summary: 'Error Summary', detail: 'Ingestion Failed', life: 6000 });
toast.add({ severity: 'error', summary: 'Error Summary', detail: 'Deletion Failed', life: 6000 });
})
},
reject: () => {
@@ -111,15 +111,10 @@ function formatDate(dateString) {
{{ formatDate(data.ingestionDate) }}
</template>
</Column>
<Column field="ingestionStatus" header="ingestionStatus">
<template #body="{ data }">
{{ data.ingestionStatus }}
</template>
</Column>
<Column :exportable="false" style="min-width: 12rem">
<template #body="slotProps">
<Button text raised rounded severity="info" type="button" class="mr-2" icon="pi pi-play"
@click="ingesttext(slotProps.data)" v-tooltip.top="'Start Ingestion of text'">
<Button text raised rounded severity="info" type="button" class="mr-2" icon="pi pi-trash"
@click="deleteRecords(slotProps.data)" v-tooltip.top="'Delete the records'">
</Button>
</template>
</Column>