add changes from v0.3
This commit is contained in:
23
pages/offline.js
Normal file
23
pages/offline.js
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user