Speakers form is now working pretty well. Including delete.
This commit is contained in:
@@ -822,7 +822,7 @@ export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_
|
||||
|
||||
|
||||
// Updated 2023-07-24
|
||||
export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_type, field_name=null, field_value=null, fields={}, key, jwt=null, headers={}, params={}, data={}, return_obj=false, return_meta=false, log_lvl=0}) {
|
||||
export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_type, field_name=null, field_value=null, fields={}, key, jwt=null, headers={}, params={}, data={}, return_obj=false, obj_v_name='', return_meta=false, log_lvl=0}) {
|
||||
if (log_lvl) {
|
||||
console.log('*** create_ae_obj_crud() ***');
|
||||
}
|
||||
@@ -831,6 +831,12 @@ export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_
|
||||
data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API.
|
||||
// This is not currently being exposed to other areas of the code. It is only used here. For now?
|
||||
if (obj_v_name) {
|
||||
obj_v_name = '';
|
||||
}
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account`;
|
||||
@@ -864,6 +870,7 @@ export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_
|
||||
endpoint = `/crud/event/presentation`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter`;
|
||||
// obj_v_name = 'event_presenter_soft_links';
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
@@ -906,6 +913,11 @@ export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_
|
||||
|
||||
if (return_obj) {
|
||||
params['return_obj'] = true;
|
||||
|
||||
// Pass along the view name to use for returning data.
|
||||
if (obj_v_name) {
|
||||
params['obj_v_name'] = obj_v_name;
|
||||
}
|
||||
} else {
|
||||
params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object.
|
||||
}
|
||||
@@ -955,7 +967,7 @@ export let create_ae_obj_crud = async function create_ae_obj_crud({api_cfg, obj_
|
||||
|
||||
|
||||
// Updated 2023-06-28
|
||||
export let update_ae_obj_id_crud = async function update_ae_obj_id_crud({api_cfg, obj_type, obj_id, field_name, field_value, fields={}, key, jwt=null, headers={}, params={}, data={}, return_obj=false, return_meta=false, log_lvl=0}) {
|
||||
export let update_ae_obj_id_crud = async function update_ae_obj_id_crud({api_cfg, obj_type, obj_id, field_name, field_value, fields={}, key, jwt=null, headers={}, params={}, data={}, return_obj=false, obj_v_name='', return_meta=false, log_lvl=0}) {
|
||||
if (log_lvl) {
|
||||
console.log('*** update_ae_obj_id_crud() ***');
|
||||
}
|
||||
@@ -964,6 +976,12 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud({api_cfg
|
||||
data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API.
|
||||
// This is not currently being exposed to other areas of the code. It is only used here. For now?
|
||||
if (obj_v_name) {
|
||||
obj_v_name = '';
|
||||
}
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/${obj_id}`;
|
||||
@@ -997,6 +1015,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud({api_cfg
|
||||
endpoint = `/crud/event/presentation/${obj_id}`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/${obj_id}`;
|
||||
// obj_v_name = 'event_presenter_soft_links';
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/${obj_id}`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
@@ -1039,6 +1058,13 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud({api_cfg
|
||||
|
||||
if (return_obj) {
|
||||
params['return_obj'] = true;
|
||||
|
||||
// Pass along the view name to use for returning data.
|
||||
if (obj_v_name) {
|
||||
params['obj_v_name'] = obj_v_name;
|
||||
}
|
||||
} else {
|
||||
params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object.
|
||||
}
|
||||
|
||||
if (field_name) {
|
||||
|
||||
Reference in New Issue
Block a user