blog base functions fix
This commit is contained in:
parent
30f0c0ae55
commit
42c732a90d
|
@ -34,13 +34,17 @@ export default function Blog() {
|
||||||
tmpArticles.pop();
|
tmpArticles.pop();
|
||||||
for (let i = 0; i < res.data.length; i++) {
|
for (let i = 0; i < res.data.length; i++) {
|
||||||
tmpArticles.push(<h1>{res.data[i].title}</h1>);
|
tmpArticles.push(<h1>{res.data[i].title}</h1>);
|
||||||
for (let j = 0; j < res.data[i].tags.length; j++) {
|
|
||||||
tmpArticles.push(<small>{res.data[i].tags[j].name}</small>);
|
|
||||||
}
|
|
||||||
tmpArticles.push(<small>
|
tmpArticles.push(<small>
|
||||||
{new Date(res.data[i].createdAt).toLocaleDateString()}
|
{new Date(res.data[i].createdAt).toLocaleDateString()}
|
||||||
</small>);
|
</small>);
|
||||||
tmpArticles.push(<div>{res.data[i].sanitizedHtml}</div>);
|
tmpArticles.push(<br/>);
|
||||||
|
for (let j = 0; j < res.data[i].tags.length; j++) {
|
||||||
|
tmpArticles.push(<small>
|
||||||
|
{res.data[i].tags[j].name} </small>);
|
||||||
|
}
|
||||||
|
tmpArticles.push(<div
|
||||||
|
dangerouslySetInnerHTML=
|
||||||
|
{{__html: res.data[i].sanitizedHtml}}></div>);
|
||||||
}
|
}
|
||||||
console.log('test');
|
console.log('test');
|
||||||
setArticles([...tmpArticles]);
|
setArticles([...tmpArticles]);
|
||||||
|
|
|
@ -15,7 +15,6 @@ router.delete('/signout', async (_req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/articles/:page', async (req, res) => {
|
router.get('/articles/:page', async (req, res) => {
|
||||||
console.log(parseInt(req.params.page));
|
|
||||||
const articles = await Article.findAll({
|
const articles = await Article.findAll({
|
||||||
attributes: [
|
attributes: [
|
||||||
'title',
|
'title',
|
||||||
|
|
Loading…
Reference in New Issue