General work through out the day. Lots of interruptions from the dogs.
This commit is contained in:
@@ -99,9 +99,65 @@ async function handle_load_ae_obj_code__data_store({ api_cfg, code=null, data_ty
|
||||
}
|
||||
|
||||
|
||||
async function handle_update_ae_obj_id_crud({api_cfg, object_type, object_id, field_name, new_field_value, params={}, try_cache=false}) {
|
||||
|
||||
let patch_result: any = null;
|
||||
|
||||
ae_promises.api_update__ae_obj = api.update_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: object_type,
|
||||
obj_id: object_id,
|
||||
field_name: field_name,
|
||||
field_value: new_field_value,
|
||||
// fields: data,
|
||||
key: api_cfg.api_crud_super_key,
|
||||
// jwt: null,
|
||||
// params: params,
|
||||
// data: patch_data,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (results) {
|
||||
console.log('PATCH Promise', results);
|
||||
|
||||
if (results) {
|
||||
console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`);
|
||||
patch_result = 'PATCH complete';
|
||||
} else {
|
||||
console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`);
|
||||
patch_result = 'PATCH failed';
|
||||
return false;
|
||||
}
|
||||
|
||||
// dispatch(
|
||||
// 'ae_crud_updated',
|
||||
// {
|
||||
// 'type': object_type,
|
||||
// 'id': object_id,
|
||||
// 'field_name': field_name,
|
||||
// 'field_value': new_field_value,
|
||||
// 'original_value': original_field_value,
|
||||
// }
|
||||
// );
|
||||
return true;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('Something went wrong patching the record.');
|
||||
console.log(error);
|
||||
return false;
|
||||
})
|
||||
.finally(function () {
|
||||
console.log('PATCH Promise finally');
|
||||
});
|
||||
|
||||
return ae_promises.api_update__ae_obj;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
let export_obj = {
|
||||
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
|
||||
handle_load_ae_obj_code__data_store: handle_load_ae_obj_code__data_store,
|
||||
handle_update_ae_obj_id_crud: handle_update_ae_obj_id_crud,
|
||||
};
|
||||
export let core_func = export_obj;
|
||||
|
||||
Reference in New Issue
Block a user