How to use the cosmicjs.deleteObject function in cosmicjs

To help you get started, we’ve selected a few cosmicjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cosmicjs / notetoself / index.js View on Github external
content: ''
                        }
                        Cosmic.editObject(config, params, (error, response)=>{
                          if(response.object){
                            console.log(chalk.green("\u2713" + " Success"))
                          }
                          MainMenu()
                        })
                      })
                    
                  } else if(answers.morecontext === 'delete'){
                    var params = {
                      write_key: config.bucket.write_key,
                      slug: response.object.slug
                    }
                    Cosmic.deleteObject(config, params, (error, response)=>{
                      if(error){
                        console.log(error)
                      }
                      if(response.object){
                        console.log(chalk.green("\u2713" + " Success"))
                      }
                      MainMenu();
                    });
                  } else {
                    MainMenu();
                  }
                })
              })
github tonyspiro / react-flux-cosmicjs / stores / ListStore.js View on Github external
removeItem: function(payload){
    
    let _id = payload._id;
    let _this = this;
    let delete_object = {
      _id: _id
    };

    Cosmic.deleteObject(config, delete_object, function(err, object){
      
      let items = _this.items;
      
      _.remove(items,(item) => {
        return _id == item._id;
      });

      _this.items = items;
      _this.emitChange();

    });

  },
github cosmicjs / sticky-notes / client / containers / Home / sagas.js View on Github external
async.eachSeries(notes, (note, callback) => {
    const params = {
      write_key: config.bucket.write_key,
      slug: note.slug,
    };
    if (!!note.metafields && !!note.metafields[1]) {
      deleteMedia(note.metafields[1].id);
    }

    if (!!note.metafields && !!note.metafields[2]) {
      deleteMedia(note.metafields[2].id);
    }
    Cosmic.deleteObject(config, params, (err, res)=> {
      callback();
    })
  });
  const response = yield call(cosmic, "DELETE", params);

cosmicjs

The official client module for Cosmic. This module helps you easily add dynamic content to your website or application using the Cosmic headless CMS.

MIT
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis