cont3xt/vueapp/src/components/services/LinkService.js
/**
   * Updates a link group.
   * @param {Object} linkGroup - The new link group data
   * @returns {Promise} - The promise that either resovles the or rejects in error
   */
Updates a link group.
@param {Object} linkGroup - The new link group data
@returns {Promise} - The promise that either resovles the or rejects in error
Updates a link group . @param { Object } linkGroup - The new link group data @returns { Promise } - The promise that either resovles the or rejects in error
updateLinkGroup (linkGroup) {
    store.commit('SET_LINK_GROUPS_ERROR', '');
    for (const link of linkGroup.links) {
      delete link.expanded; 
    }
    return new Promise((resolve, reject) => {
      fetch(`api/linkGroup/${linkGroup._id}`, {
        method: 'PUT',
        headers: setReqHeaders({ 'Content-Type': 'application/json' }),
        body: JSON.stringify(linkGroup)
      }).then((response) => {
        return response.json();
      }).then((response) => {
        if (response.success) {
          store.commit('UPDATE_LINK_GROUP', linkGroup);
          return resolve(response);
        } else {
          store.commit('SET_LINK_GROUPS_ERROR', response.text);
          return reject(response.text);
        }
      });
    });
  }
updateLinkGroup ( linkGroup ) { store . commit ( 'SET_LINK_GROUPS_ERROR' , '' ) ; for ( const link of linkGroup . links ) { delete link . expanded ; } return new Promise ( ( resolve , reject ) => { fetch ( ` ${ linkGroup . _id } ` , { method : 'PUT' , headers : setReqHeaders ( { 'Content-Type' : 'application/json' } ) , body : JSON . stringify ( linkGroup ) } ) . then ( ( response ) => { return response . json ( ) ; } ) . then ( ( response ) => { if ( response . success ) { store . commit ( 'UPDATE_LINK_GROUP' , linkGroup ) ; return resolve ( response ) ; } else { store . commit ( 'SET_LINK_GROUPS_ERROR' , response . text ) ; return reject ( response . text ) ; } } ) ; } ) ; }
Updates a link group.
Updates a link group .
// clear link expanded prop, it's just for the UI