adds deleteProfilRequest to the new ProfilUpdate FhcAPIController

This commit is contained in:
SimonGschnell
2024-07-19 14:57:42 +02:00
parent 8700abd0fa
commit 0cc6222175
3 changed files with 22 additions and 9 deletions
@@ -46,8 +46,8 @@ class ProfilUpdate extends FHCAPI_Controller
'selectProfilRequest' => self::PERM_LOGGED,
'insertProfilRequest' => self::PERM_LOGGED,
'updateProfilRequest' => self::PERM_LOGGED,
]);
'deleteProfilRequest' => self::PERM_LOGGED,
]);
// Load language phrases
$this->loadPhrases(
@@ -238,6 +238,17 @@ class ProfilUpdate extends FHCAPI_Controller
$this->terminateWithSuccess(success($updateID));
}
public function deleteProfilRequest()
{
$requestID = $this->input->post('requestID', true);
$result = $this->ProfilUpdateModel->delete([$requestID]);
if (isError($result)) {
$this->terminateWithError(getError($result));
}
$this->terminateWithSuccess($result);
}
public function getProfilRequestFiles($id)
{
if(!$id){
+6 -5
View File
@@ -100,14 +100,15 @@ export default {
});
},
//TODO post request
deleteProfilRequest: function (requestID) {
const url =
return this.$fhcApi.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/Cis/ProfilUpdate/deleteProfilRequest`;
return axios.post(url, requestID);
`/api/frontend/v1/ProfilUpdate/deleteProfilRequest`,
{
requestID,
});
},
};
@@ -107,17 +107,18 @@ export default {
},
deleteRequest: function (item) {
Vue.$fhcapi.ProfilUpdate.deleteProfilRequest(item.profil_update_id).then(
this.$fhcApi.factory.profilUpdate.deleteProfilRequest(item.profil_update_id).then(
(res) => {
if (res.data.error) {
//? open alert
console.log(res.data);
console.error("error happened",res.data);
} else {
this.$emit("fetchUpdates");
}
}
);
},
getView: function (topic, status) {
if (!(status === this.profilUpdateStates["Pending"])) {
return "Status";