Last active
September 30, 2019 11:03
-
-
Save Akryum/bb05ad75ed79030ca8c91dea08cc5a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<RouteController /> | |
<nav>...</nav> | |
<router-view/> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
apollo: { | |
user: { | |
// ... | |
} | |
}, | |
async onBeforeEachRoute (to, from, next) { | |
await this.$apollo.firstLoad | |
if (this.user) { | |
} | |
next() | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createRouter (apolloProvider) { | |
const router = new Router() | |
router.beforeEach(async (to, from, next) => { | |
const { data: { user } } = await apolloProvider.clients.default.query({ | |
// ... | |
}) | |
if (user) { | |
} | |
next() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment