@mustafarefaey/laravel-hybrid-spa-page-state-loader

1.0.1 • Public • Published

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-loader

Usage

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);
  }
});

Readme

Keywords

Package Sidebar

Install

npm i @mustafarefaey/laravel-hybrid-spa-page-state-loader

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

2.63 kB

Total Files

4

Last publish

Collaborators

  • mustafarefaey