import { createStore } from "vuex";

console.log(import.meta.env.VITE_PROJECT_ENV);
let baseurl = import.meta.env.VITE_BASEURL;
const idCardUrl = `${baseurl}cos/uploadIdCard`;
const addCertsUrl = `${baseurl}cos/uploadShipCertNew`;
const updateCertsUrl = `${baseurl}cos/uploadShipCertUpdate`;

const store = createStore({
  state: {
    isLogin: false,
    firstTitle: "",
    secondTitle: "",
    currentMenuItem: "/voyage/voyageList",
    baseurl,
    idCardUrl,
    addCertsUrl,
    updateCertsUrl,
    versions: [],
  },
  mutations: {
    changefirstTitle(state, text) {
      state.firstTitle = text;
    },
    changeTitleSecond(state, text) {
      state.secondTitle = text;
    },
    changeLogin(state, b) {
      state.isLogin = b;
    },
    setCurrentMenuItem(state, index) {
      state.currentMenuItem = index;
    },
    setVersions(state, data) {
      state.versions = data;
    },
  },
});

export default store;
