Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

데이터 영속 관리를 위하여 session에 저장해야합니다. #34

Open
kwangilcho opened this issue Nov 14, 2018 · 1 comment
Assignees

Comments

@kwangilcho
Copy link
Contributor

vue-session을 활용하여 component - vuex - localStorage 구조를 만들어서 데이터 영속 관리를 합시다.

예시:

In main.js

import VueSession from 'vue-session'
Vue.use(VueSession, {persist: true})

In Store.js or store/index.js

import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

let store =  new Vuex.Store({
    state: {
        isLoggedIn: false,
    },
    getters: {
        isLoggedIn:function(state){
            return state.isLoggedIn;
        },
        user:function(state){
            // console.log(store);
            return store._vm.$session.get('user');
        }
    },
    mutations: {
        saveUser(state,payload){
            console.log('user payload', payload);
            // this._vm.$session.start();
            store._vm.$session.set('user',payload);
            state.isLoggedIn = (payload != null)
        }
    },
    actions: {
        
    }
});

export default store
@kwangilcho
Copy link
Contributor Author

kwangilcho commented Dec 6, 2018

  • 거래처별 설정

  • 선택한 지정상품 상태

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants