import { createStore } from 'vuex'
import global from './global'
import ose_card_store from "@/module/ose-card/store/ose_card_store";
import countdown_timer_store from "@/module/conutdown-timer/store/countdown-timer-store"
import user from "@/store/module/user"
import directus from "@/store/module/directus";
import common from "@/store/module/common";
import createPersistedState from "vuex-persistedstate";

const store = createStore({
    ...global,
    modules: {
        common,
        directus,
        ose_card_store,
        countdown_timer_store,
        user,

    },
    plugins: [
        createPersistedState({
            storage:window.sessionStorage,
            key:'edit_card_data',
            reducer: (state) => state.ose_card_store.edit_card_data
        }),
        createPersistedState({
            storage:window.sessionStorage,
            key:'edit_countdown_timer_data',
            reducer: (state) => state.countdown_timer_store.edit_countdown_timer_data
        }),
        createPersistedState({
            storage:window.sessionStorage,
            key:'user',
            reducer: (state) => state.user
        })
    ]
})

export default store
