import { filterAsyncRoutes, } from "@/utills/handleRoutes";
import { asyncRoutes, constantRoutes } from "@/router";
const state = () => ({
  routes: [],
});

const mutations = {
  setRoutes(state, routes) {
    state.routes = constantRoutes.concat(routes);
  },

};
const actions = {
  async setRoutes({ commit }, permissions) {
    const finallyAsyncRoutes = await filterAsyncRoutes(
      [...asyncRoutes],
      permissions
    );
    commit("setRoutes", finallyAsyncRoutes);
    return finallyAsyncRoutes;
  },
};
export default { namespaced: true, state, mutations, actions };