Skip to content

Instantly share code, notes, and snippets.

View rayfranco's full-sized avatar

Franco Bouly rayfranco

View GitHub Profile
@rayfranco
rayfranco / nuxt.config.js
Created June 1, 2018 11:16
Remove hash from filenames in Nuxt
module.exports = {
build: {
// Remove hash from build files
filenames: {
css: 'common.css',
manifest: 'manifest.js',
vendor: 'common.js',
app: 'app.js',
chunk: '[name].js'
@rayfranco
rayfranco / checkStatus.js
Created June 21, 2018 15:03
Check for status code change periodically. Designed to be pasted in Chrome Dev Tools to bypass any CORS issues.
function check (DELAY_MINUTE = 1, RESPONSE_CODE = 200) {
var req = new XMLHttpRequest()
req.addEventListener('load', onLoad)
function open () {
req.open('HEAD', location.href, true)
req.send()
}
function onLoad () {
req.status === RESPONSE_CODE ? notify() : setTimeout(open, DELAY_MINUTE * 60 * 1000)
}
router.beforeEach((to, from, next) => {
const requiresAuth = to.matched.some(record => {
return record.meta.requiresAuth
})
if (requiresAuth && !store.$data.isRegistered) {
next('/login')
} else {
next()
}
})