add changes from v0.3

This commit is contained in:
JJ Kasper
2018-11-24 00:23:32 -06:00
parent 73f05ce4a3
commit 111cf2ed35
133 changed files with 10768 additions and 7443 deletions

23
pages/offline.js Normal file
View File

@@ -0,0 +1,23 @@
import { useEffect } from 'react'
import Router from 'next/router'
import addBase from '../src/util/addBase'
export default function Offline() {
// force next to render correct route on mount
useEffect(() => {
const { pathname, search } = window.location
let origRoute = pathname + search
let curRoute = origRoute.split(addBase('/'))
curRoute.splice(0, 1)
curRoute = '/' + curRoute.join(addBase('/'))
if (curRoute === '/offline' && navigator.onLine) {
curRoute = '/'
origRoute = '/'
}
Router.push(curRoute, origRoute)
}, [])
return null
}