Remove front-end preview
This commit is contained in:
parent
e981c52a59
commit
e20be4c188
1 changed files with 1 additions and 30 deletions
31
src/App.js
31
src/App.js
|
|
@ -1,7 +1,6 @@
|
|||
import React, { Component } from 'react'
|
||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
|
||||
import Helmet from 'react-helmet'
|
||||
import _merge from 'lodash/merge'
|
||||
import _findIndex from 'lodash/findIndex'
|
||||
import _kebabCase from 'lodash/kebabCase'
|
||||
|
||||
|
|
@ -18,39 +17,12 @@ import Footer from './components/Footer'
|
|||
import GithubCorner from './components/GithubCorner'
|
||||
import ServiceWorkerNotifications from './components/ServiceWorkerNotifications'
|
||||
import AOS from './components/AOS'
|
||||
import Spinner from './components/Spinner'
|
||||
import data from './data.json'
|
||||
import { documentHasTerm, getCollectionTerms } from './util/collection'
|
||||
|
||||
class App extends Component {
|
||||
state = {
|
||||
data,
|
||||
loading: false
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
this.fetchPreviewContent()
|
||||
}
|
||||
|
||||
fetchPreviewContent = () => {
|
||||
if (
|
||||
!window.netlifyIdentity ||
|
||||
!window.netlifyIdentity.currentUser() ||
|
||||
process.env.NODE_ENV === 'development'
|
||||
) {
|
||||
return false
|
||||
}
|
||||
import('./util/fetch-content').then(({ fetchContent }) => {
|
||||
this.setState({ loading: true })
|
||||
fetchContent()
|
||||
.then(newData => {
|
||||
this.setState(prevState => {
|
||||
const data = _merge(prevState.data, newData)
|
||||
return { data, loading: false }
|
||||
})
|
||||
})
|
||||
.catch(() => this.setState({ loading: false }))
|
||||
})
|
||||
data
|
||||
}
|
||||
|
||||
getDocument = (collection, name) =>
|
||||
|
|
@ -80,7 +52,6 @@ class App extends Component {
|
|||
return (
|
||||
<Router>
|
||||
<div className='React-Wrap'>
|
||||
{this.state.loading && <Spinner />}
|
||||
<AOS options={{ duration: 250 }} />
|
||||
<ScrollToTop />
|
||||
<ServiceWorkerNotifications reloadOnUpdate />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue