Sort of bug fix for file uploads
This commit is contained in:
@@ -270,22 +270,23 @@ async function handle_delete_post_obj(
|
|||||||
async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_file_obj_li: any[]) {
|
async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_file_obj_li: any[]) {
|
||||||
console.log(`*** handle_hosted_files_uploaded() *** ${hosted_file_id_li}`);
|
console.log(`*** handle_hosted_files_uploaded() *** ${hosted_file_id_li}`);
|
||||||
|
|
||||||
|
// NOTE: No longer directly updating the $idaa_slct.post_obj.hosted_file_obj_li. This will be updated when the PATCH API for Post update finishes.
|
||||||
// We need to add the record to the $idaa_slct.post_obj.hosted_file_obj_li and then update the post_obj.linked_li_json with the new value.
|
// We need to add the record to the $idaa_slct.post_obj.hosted_file_obj_li and then update the post_obj.linked_li_json with the new value.
|
||||||
|
let new_linked_li_json = $idaa_slct.post_obj.linked_li_json ?? [];
|
||||||
if (!$idaa_slct.post_obj.linked_li_json) {
|
if (!$idaa_slct.post_obj.linked_li_json) {
|
||||||
$idaa_slct.post_obj.linked_li_json = hosted_file_obj_li;
|
// $idaa_slct.post_obj.linked_li_json = hosted_file_obj_li;
|
||||||
|
new_linked_li_json = hosted_file_obj_li;
|
||||||
} else {
|
} else {
|
||||||
// $idaa_slct.post_obj.linked_li_json.append(hosted_file_obj_li);
|
// $idaa_slct.post_obj.linked_li_json.push(...hosted_file_obj_li);
|
||||||
$idaa_slct.post_obj.linked_li_json.push(...hosted_file_obj_li);
|
new_linked_li_json = [...new_linked_li_json];
|
||||||
}
|
}
|
||||||
|
|
||||||
prom_api__post_obj = posts_func.update_ae_obj__post({
|
prom_api__post_obj = posts_func.update_ae_obj__post({
|
||||||
api_cfg: $ae_api,
|
api_cfg: $ae_api,
|
||||||
post_id: $idaa_slct.post_id,
|
post_id: $idaa_slct.post_id,
|
||||||
data_kv: {
|
data_kv: {
|
||||||
linked_li_json: JSON.stringify($idaa_slct.post_obj.linked_li_json),
|
// linked_li_json: JSON.stringify($idaa_slct.post_obj.linked_li_json),
|
||||||
// hosted_file_id_random: hosted_file_obj_li[0].hosted_file_id_random,
|
linked_li_json: JSON.stringify(new_linked_li_json),
|
||||||
// filename: hosted_file_obj_li[0].filename,
|
|
||||||
// file_extension: hosted_file_obj_li[0].extension,
|
|
||||||
},
|
},
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user