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