Creating standardized functions. Mainly for create and delete.
This commit is contained in:
@@ -139,7 +139,7 @@ export async function create_ae_obj__archive_content(
|
||||
data_kv,
|
||||
params={},
|
||||
try_cache = true,
|
||||
log_lvl=0
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
archive_id: string,
|
||||
@@ -149,7 +149,9 @@ export async function create_ae_obj__archive_content(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`);
|
||||
}
|
||||
|
||||
ae_promises.create__archive_content = await api.create_ae_obj_crud({
|
||||
api_cfg: api_cfg,
|
||||
@@ -179,8 +181,6 @@ export async function create_ae_obj__archive_content(
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
@@ -221,18 +221,16 @@ export async function delete_ae_obj_id__archive_content(
|
||||
method: method,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (archive_content_obj_delete_result) {
|
||||
// if (archive_content_obj_delete_result) {
|
||||
// return archive_content_obj_delete_result;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
db_archives.content.delete(archive_content_id); // Delete from the DB no matter what.
|
||||
if (try_cache) {
|
||||
if (log_lvl) {
|
||||
console.log(`Attempting to remove IDB entry for archive_content_id=${archive_content_id}`);
|
||||
}
|
||||
db_archives.content.delete(archive_content_id); // Delete from the DB no matter what.
|
||||
}
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
|
||||
Reference in New Issue
Block a user