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: [], keepAliveList: ["shipList", "shipOwnerList"], }, mutations: { changefirstTitle(state, text) { state.firstTitle = text; }, changeShippingCompany(state, text) { state.shippingCompany = 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; }, addAlive(state, data) { let arr = state.keepAliveList; arr.push(data); state.keepAliveList = [...new Set(arr)]; }, removeAlive(state, data) { let arr = state.keepAliveList.filter((item) => { return item != data; }); state.keepAliveList = arr; }, clearAlive(state, data) { state.keepAliveList = []; }, }, }); export default store;