forked from tanner/qotnews
refactor: Improve article loading error and cache messages
This commit is contained in:
@@ -36,7 +36,7 @@ function Article({ cache }) {
|
||||
localForage.setItem(id, result.story);
|
||||
},
|
||||
(error) => {
|
||||
const errorMessage = `Failed to fetch article content (ID: ${id}). Your connection may be down or the server might be experiencing issues. ${error.toString()}.`;
|
||||
const errorMessage = `Failed to fetch new article content (ID: ${id}). Your connection may be down or the server might be experiencing issues. ${error.toString()}.`;
|
||||
setError(errorMessage);
|
||||
}
|
||||
);
|
||||
@@ -60,6 +60,7 @@ function Article({ cache }) {
|
||||
<details style={{marginBottom: '1rem', visibility: error ? 'visible' : 'hidden'}}>
|
||||
<summary>Connection error? Click to expand.</summary>
|
||||
<p>{error}</p>
|
||||
{story && <p>Loaded article from cache.</p>}
|
||||
</details>
|
||||
{story ?
|
||||
<div className='article'>
|
||||
@@ -101,7 +102,7 @@ function Article({ cache }) {
|
||||
}
|
||||
</div>
|
||||
:
|
||||
<p>loading...</p>
|
||||
<p>Loading...</p>
|
||||
}
|
||||
<ToggleDot id={id} article={false} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user