@mustafarefaey/laravel-hybrid-spa-page-state-loader
v1.0.1
Published
"This package is meant to be used in conjunction with `Laravel hybrid SPA`. It provides the functionality to load page state."
Readme
This package is meant to be used in conjunction with Laravel hybrid SPA. It provides the functionality to load page state.
Installation
npm install @mustafarefaey/laravel-hybrid-spa-page-state-loaderUsage
import { loadPageState } from '@mustafarefaey/laravel-hybrid-spa-page-state-loader';After creating an instance of Vue router, add this navigation guard
router.beforeEach(async (to, from, next) => {
const pageStateLoaded = await loadPageState(
'__PAGE_STATE__',
to.fullPath,
(err) => console.error(err)
);
if (pageStateLoaded) {
next();
} else {
next(false);
}
});