Skip to content

Commit

Permalink
Fix size images articles
Browse files Browse the repository at this point in the history
  • Loading branch information
Smaug6739 committed Apr 3, 2021
1 parent 3e2ece8 commit 21cd73c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion __frontend/controllers/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ exports.getRandom = (req, res) => {

exports.getUpdateArticlePage = (req, res) => {
if (!req.user.permissions.includes('ADMINISTRATOR') && !req.user.permissions.includes('MANAGE_ARTICLES')) return res.status(401).redirect('/')
axios.get(`http://localhost:8080/api/v1/articles/${req.session.user.id}/${req.params.articleId}`, {
axios.get(`http://localhost:8080/api/v1/articles/view/${req.params.articleId}`, {
headers: { 'Authorization': `${req.session.user.id} ${req.session.user.token}` },
})
.then(async (responce) => {
Expand Down
2 changes: 1 addition & 1 deletion __frontend/controllers/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ exports.postArticle = async (req, res) => {
}
let htmlContent = "";
htmlContent = md.render(req.body.contenu) //converter.makeHtml(req.body.contenu)
axios.post(`http://localhost:8080/api/v1/articles/${req.session.user.id}`, {
axios.post(`http://localhost:8080/api/v1/articles`, {
categorie: req.body.categorie,
title: req.body.title,
miniature: file,
Expand Down
4 changes: 3 additions & 1 deletion __frontend/public/css/articles/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ thead,tfoot {
background-color: rgb(143, 138, 138);
color: #fff;
}

.content img{
max-width: 80%;
}
#center{
display: block;
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion __frontend/routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ AdminRouter.get('/articles/random/createur', adminMid, adminCtrl.getRandom)
AdminRouter.get('/articles/:page', adminMid, adminCtrl.getArticles)
AdminRouter.get('/articles/update/:articleId', adminMid, adminCtrl.getUpdateArticlePage)

AdminRouter.post('/articles/update/:articleId', multerMidMiniature, adminCtrl.updateArticle)
AdminRouter.post('/articles/update/:articleId', adminMid, multerMidMiniature, adminCtrl.updateArticle)

AdminRouter.get('/albums/:page', adminMid, adminCtrl.getAlbums)
AdminRouter.get('/albums/update/:albumId', adminMid, adminCtrl.getAlbum)
Expand Down
6 changes: 2 additions & 4 deletions backend/controllers/articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports.getRandomArticle = (req, res) => {

}
exports.putArticle = (req, res) => {
console.log('log');
if (hasPermissions(req.user.permissions, ['MANAGE_ARTICLES']) || req.params.userId === req.user.id) {
Articles.put(
req.params.userId,
Expand All @@ -52,10 +53,7 @@ exports.deleteArticle = (req, res) => {
}
exports.getArticle = (req, res) => {
Articles.getArticle(req.params.articleId)
.then(result => {
if (result.status !== 1) res.json(checkAndChange(new Error("Cet article n'est pas encore aprouvé.")))
else res.json(checkAndChange(result))
})
.then(result => res.json(checkAndChange(result)))
.catch(error => res.json(checkAndChange(new Error(error))))
}

Expand Down

0 comments on commit 21cd73c

Please sign in to comment.