Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
created() {
Cosmic.getObjectType({ bucket }, { type_slug: 'globals' }, (err, res) => {
EventBus.$emit('global_loaded', res.objects.all[0]);
console.log(res.objects.all[0]);
});
},
}
const ViewNotes = () => {
if (!config.bucket.slug) {
MainMenu()
return
}
var params = {
type_slug: 'notes',
limit: 10,
skip: 0
};
Cosmic.getObjectType(config, params, (error, response)=>{ //fetches all notes
var notes = []
var noteText = [chalk.yellow("Return")]
if(error || response.total === undefined){
console.log(chalk.red("No notes found."))
MainMenu()
return;
}
sortedresponse = response.objects.all.sort((a,b)=>{
return new Date(b.created) - new Date(a.created)
})
const amount = response.objects.all.length
sortedresponse.map((note)=>{
var newnote = {
name: note.title,
slug: note.slug
}
created() {
Cosmic.getObjectType({ bucket }, { type_slug: 'photos' }, (err, res) => {
this.items = res.objects.all;
EventBus.$emit('loaded', this.items[0]);
});
EventBus.$on('move', (dir) => {
this.activeIndex = this.activeIndex + dir;
if (dir > 0 && this.activeIndex >= this.items.length) {
this.activeIndex = 0;
}
if (dir < 0 && this.activeIndex < 0) {
this.activeIndex = this.items.length - 1;
}
EventBus.$emit('loaded', this.items[this.activeIndex]);
});
},
data () {
app.get('/api/appointments', (req, res) => {
Cosmic.getObjectType(config, { type_slug: 'appointments' }, (err, response) => {
const appointments = response.objects.all ? response.objects.all.map(appointment => {
return {
date: appointment.metadata.date,
slot: appointment.metadata.slot
}
}) : {}
res.json({ data: appointments })
})
})
app.get('/', function(req, res) {
var Cosmic = require('cosmicjs')
Cosmic.getObjectType(config, { type_slug: 'crons' }, function(err, response) {
res.locals.crons = response.objects.all
res.locals.bucket_slug = config.bucket.slug
res.render('index.html')
})
})
}