Clear localstorage cache and add slogan
This commit is contained in:
parent
1b6c8fc6cb
commit
2b1a352917
|
@ -35,6 +35,8 @@ class App extends React.Component {
|
||||||
<p>
|
<p>
|
||||||
<Link to='/'>QNN - Home</Link>
|
<Link to='/'>QNN - Home</Link>
|
||||||
<span className='theme'>Theme: <a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span>
|
<span className='theme'>Theme: <a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span>
|
||||||
|
<br />
|
||||||
|
<span className='slogan'>Reddit, Hacker News, and Tildes combined, then pre-rendered in reader mode.</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Route path='/' exact component={Feed} />
|
<Route path='/' exact component={Feed} />
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { sourceLink, infoLine } from './utils.js';
|
import { sourceLink, infoLine } from './utils.js';
|
||||||
|
import { clearStorage } from './utils.js';
|
||||||
|
|
||||||
const apiUrl = 'http://news-api.dns.t0.vc/';
|
const apiUrl = 'http://news-api.dns.t0.vc/';
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ class Feed extends React.Component {
|
||||||
.then(
|
.then(
|
||||||
(result) => {
|
(result) => {
|
||||||
this.setState({ stories: result.stories });
|
this.setState({ stories: result.stories });
|
||||||
|
clearStorage();
|
||||||
localStorage.setItem('stories', JSON.stringify(result.stories));
|
localStorage.setItem('stories', JSON.stringify(result.stories));
|
||||||
result.stories.slice(0, 25).forEach(x => {
|
result.stories.slice(0, 25).forEach(x => {
|
||||||
fetch(apiUrl + x.id)
|
fetch(apiUrl + x.id)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .item .info a.hot {
|
.dark .item .info a.hot {
|
||||||
color: #CCCCCC;
|
color: #cccccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .article a {
|
.dark .article a {
|
||||||
|
|
|
@ -20,6 +20,10 @@ a {
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.slogan {
|
||||||
|
color: #828282;
|
||||||
|
}
|
||||||
|
|
||||||
.theme {
|
.theme {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,3 +20,9 @@ export const infoLine = (story) =>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
;
|
;
|
||||||
|
|
||||||
|
export const clearStorage = () => {
|
||||||
|
const themeSetting = localStorage.getItem('theme');
|
||||||
|
localStorage.clear();
|
||||||
|
localStorage.setItem('theme', themeSetting);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user