Zaklad ssr

This commit is contained in:
Michal Kváček
2023-11-14 16:20:01 +01:00
parent e65491e00b
commit 331ebbc4e4
19 changed files with 298 additions and 84 deletions
+2 -11
View File
@@ -3,16 +3,7 @@ import {createRouter, createMemoryHistory, createWebHistory, createWebHashHistor
import routes from './routes'
import {useAppStore} from "stores/App";
/*
* If not building with SSR mode, you can
* directly export the Router instantiation;
*
* The function below can be async too; either use
* async/await or return a Promise which resolves
* with the Router instance.
*/
export default route(function (/* { store, ssrContext } */) {
export default route(function ({ store }) {
const createHistory = process.env.SERVER
? createMemoryHistory
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory)
@@ -29,7 +20,7 @@ export default route(function (/* { store, ssrContext } */) {
Router.afterEach(async (to, from) => {
if (from.name !== to.name) {
useAppStore().resetAfterRouteChange();
useAppStore(store).resetAfterRouteChange();
}
});