Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created July 24, 2018 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmiller1990/e9687e3bb1cbe8378c86128d175fa44e to your computer and use it in GitHub Desktop.
Save lmiller1990/e9687e3bb1cbe8378c86128d175fa44e to your computer and use it in GitHub Desktop.
import Vue from "vue"
import VueRouter from "vue-router"
import routes from "./routes.js"
import { bustCache } from "./bust-cache.js"
Vue.use(VueRouter)
const router = new VueRouter({ routes })
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.shouldBustCache)) {
bustCache()
}
next()
})
export default router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment