Giter Site home page Giter Site logo

vuex_todo_manager's Introduction

Vuex Todo Manager

This project is part of the Vuex Crash Course on YouTube

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your tests

npm run test

Lints and fixes files

npm run lint

vuex_todo_manager's People

Contributors

bradtraversy avatar dependabot[bot] avatar ngseklong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vuex_todo_manager's Issues

Need Help - Can I use The same method while adding Data to FireStore

@bradtraversy Thank you for your tutorial.

This is really helping lot. I am stuck at this point. Could you please assist me?

I am unable to update my recipeArray after inserting data to Firestore.

I am using nuxt framework

store/recipes.js

export const state = () => ({
  recipesList: []            //***This gets updated using action fetchRecipes action and used on index page
})

export const getters = {
 // There is no use of this at this point of time
}

export const actions = {
    async addRecipe({ commit }, title) {
    const response = this.$fireStore.collection('recipes')
    try {
      await response
        .add({
          title: title,
          slug: title,
          publish: true,
          created: new Date()
        })
        .then(res => {
          // eslint-disable-next-line no-console
          console.log('Added document with ID: ', res.id)   //**This is printing data on console
           commit('addRecipe', res)      //** This mutation call is where I am having issue, looks like firestore needs a separate call to get the data, can i have async call inside another async? also res does not have the required data in it to be added to recipeArray
        })
    } catch (e) {
     
      console.log(e)

      alert(e)
      return
    }
    alert('Success.')
  },


async fetchRecipes({ commit }) {
    const recipeArray = []
    const response = this.$fireStore.collection('recipes')
    try {
      await response
        .where('publish', '==', true)
        .orderBy('created', 'desc')
        .get()
        .then(querySnapshot => {
          querySnapshot.forEach(doc => {
            recipeArray.push(doc.data())
          })
        })
      commit('setRecipes', recipeArray)
    } catch (e) {
          // alert(e)
      alert('Error Fetching Data, please contact Webmaster')
    }
  }
}



export const mutations = {
  setRecipes: (state, recipesList) => (state.recipesList = recipesList),
  addRecipe: (state, recipe) => state.recipesList.unshift(recipe)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.