import { createStore } from "vuex";

export default createStore({
  state: {
    username:"",
    img:"",
    checkPage:"",
    checkLogin:"",
  },
  getters: {
   
    getUsername: (state) => {
      return state.username
    },
    getCheckLogin: (state) => {
      return state.checkLogin
    },
    getImg: (state) => {
      return state.img
    },
    getCheckPage: (state) => {
      return state.checkPage
    },
  },
  mutations: {
    setCheckLogin: (state, payload) => {
     state.checkLogin = payload;
    },
    setUsername: (state, payload) => {
      state.username = payload;
    },
    setImg: (state, payload) => {
      state.img = payload;
    },
    setCheckPage: (state, payload) => {
      state.checkPage = payload;
    },
  },
  actions: {
    setLocalStorageValue(data) {
      localStorage.setItem("username", data);
    },
    // getLocalStorageValue() {
    //   const username = localStorage.getItem("username");
    //   // ทำสิ่งที่คุณต้องการกับค่าที่ได้จาก Local Storage
    // },
 },
  modules: {},
});
