src/lib/Crowdhound.js
/*
   *  Update an existing element.
   *	If an anchor and a type is provided, the element will be created
   *	if it does not already exist.
   */
Update an existing element.
If an anchor and a type is provided, the element will be created
if it does not already exist.
Update an existing element . If an anchor and a type is provided the element will be created if it does not already exist .
update(vm, element) {
    console.log(`Crowdhound.js:update()`, element)
    console.log(`element.description.length=`, element.description.length)
    return new Promise((resolve, reject) => {
      if (this.options.debug) {
        console.log('select()')
      }
      if (this.disabled) {
        return reject(new Error('contentservice disabled'))
      }
      let url = `${this.endpoint()}/element`
      axios({
        method: 'put',
        url,
        headers: {
          'Content-Type': 'application/json',
          Accept: 'application/json'
        },
        data: element
      })
        .then((response) => {
          return resolve('ok')
        })
        .catch((e) => {
          axiosError(vm, url, element, e)
          reject(e)
        })
    }) 
  } 
update ( vm , element ) { console . log ( ` ` , element ) console . log ( ` ` , element . description . length ) return new Promise ( ( resolve , reject ) => { if ( this . options . debug ) { console . log ( 'select()' ) } if ( this . disabled ) { return reject ( new Error ( 'contentservice disabled' ) ) } let url = ` ${ this . endpoint ( ) } ` axios ( { method : 'put' , url , headers : { 'Content-Type' : 'application/json' , Accept : 'application/json' } , data : element } ) . then ( ( response ) => { return resolve ( 'ok' ) } ) . catch ( ( e ) => { axiosError ( vm , url , element , e ) reject ( e ) } ) } ) }
Update an existing element.
Update an existing element .
// let params = element // 'Authorization': 'Bearer ' + this.$contentservice.jwt, // JSON responses are automatically parsed. // console.log(`RESPONSE IS`, response.data) // let reply = response.data // - promise // update()