Giter Site home page Giter Site logo

aadamsx / vuex-accounts-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gustogummi/vuex-accounts-example

0.0 2.0 1.0 21 KB

Example app for Meteor + Vue, setting up Accounts with Vuex

License: GNU General Public License v3.0

HTML 1.87% JavaScript 32.42% Vue 65.71%

vuex-accounts-example's Introduction

vuex-accounts-example

Example app for Meteor + Vue, setting up Accounts with Vuex

Usage

Just follow standard path of installing any Meteor project:

In console:

$ git clone https://github.com/gustogummi/vuex-accounts-example.git
$ cd vuex-accounts-example
$ meteor npm install
$ meteor

In browser:

http://localhost:3000

Details

This is a basic example of how Meteor Accounts packages can play with Vue and Vuex. No validation and other goodies.

There are more ways to make it work, f.e. utilizing Vuex getters, mapState or by making method calls directly in components instead of the store actions. You can follow my way or decide on whatever you want.

But there is one thing you have to pay attention to. When you return in a Meteor helper, you can pass the cursor (actually you have to, if you want the helper to stay reactive), but data passed to the store have to be a fetched array. Here's one way to achieve it:

  meteor: {
    subscribe: {
      'users': []
    },
    usersHelper() {
    	let value = Meteor.users.find({})
      this.$store.commit('updateUsers', value.fetch())
      return value
    }
  },

I provide separate store module for authentication as I believe this will become a part of Meteor+Vue best practices.

Remember that instead of passing the state to computed properties, you can use the state directly in your templates, like that:

<p v-for="user in $store.state.auth.users">{{user.username}} ({{user.emails[0].address}})</p>

vuex-accounts-example's People

Contributors

gustogummi avatar

Watchers

James Cloos avatar Aaron Adams avatar

Forkers

c0debrain

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.