Icontem

File: app/components/test-chat/store/index.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy  >  Vuex Examples  >  app/components/test-chat/store/index.js  >  Download  
File: app/components/test-chat/store/index.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Vuex Examples
Example apps using Vuex state management pattern
Author: By
Last change:
Date: 2 years ago
Size: 977 bytes
 

Contents

Class file image Download
define([
    'vue',
    'vuex',
    'app/components/test-chat/store/actions',
    'app/components/test-chat/store/getters',
    'app/components/test-chat/store/mutations'
], function (Vue, Vuex, actions, getters, mutations) {

    Vue.use(Vuex);

    var state = {
        currentThreadID: null,
        threads: {
            /*
             id: {
             id,
             name,
             messages: [...ids],
             lastMessage
             }
             */
        },
        messages: {
            /*
             id: {
             id,
             threadId,
             threadName,
             authorName,
             text,
             timestamp,
             isRead
             }
             */
        }
    }

    // A Vuex instance is created by combining the getters, actions
    var store = new Vuex.Store({
        state: state,
        actions: actions,
        getters: getters,
        mutations: mutations
    });

    return store;
});