import { createStore } from "vuex";

console.log(import.meta.env.VITE_PROJECT_ENV);
let baseurl = import.meta.env.VITE_BASEURL;
const uploadUrl = `${baseurl}cos/upload`;
const wayBillUrl = `${baseurl}voyage/uploadVoyageWayBill`;
const fydi = `${baseurl}fydi/upload`;

const store = createStore({
  state: {
    isLogin: false,
    firstTitle: "",
    secondTitle: "",
    currentMenuItem: "/voyage/voyageList",
    baseurl,
    uploadUrl,
    wayBillUrl,
    fydi,
    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;
