blog base functions fix

This commit is contained in:
gbrochar 2020-12-02 14:01:14 +01:00
parent 30f0c0ae55
commit 42c732a90d
2 changed files with 8 additions and 5 deletions

View File

@ -34,13 +34,17 @@ export default function Blog() {
tmpArticles.pop();
for (let i = 0; i < res.data.length; i++) {
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>
{new Date(res.data[i].createdAt).toLocaleDateString()}
</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');
setArticles([...tmpArticles]);

View File

@ -15,7 +15,6 @@ router.delete('/signout', async (_req, res) => {
});
router.get('/articles/:page', async (req, res) => {
console.log(parseInt(req.params.page));
const articles = await Article.findAll({
attributes: [
'title',