How to use the leancloud-storage/dist/av.Object function in leancloud-storage

To help you get started, we’ve selected a few leancloud-storage 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 kylewh / NoMess / src / api / index.js View on Github external
export const addTodo = (text, due) => {
  if (!AV.User.current()) {
    throw new Error('You have to login')
  }
  const Todos = AV.Object.extend('Todos')
  const todo = new Todos()
  todo.set('text', text)
  todo.set('completed', false)
  todo.set('due', due)
  todo.set('owner', AV.User.current())
  return todo.save()
}
github kylewh / NoMess / src / api / index.js View on Github external
return query.get(id).then(function (oldTodo) {
    const updatedTodo = AV.Object.createWithoutData('Todos', id)
    updatedTodo.set({
      completed: oldTodo.attributes.completed,
      text,
      due: oldTodo.attributes.due
    })
    return updatedTodo.save()
  }, function (error) {
    throw new Error(error)