React Node NextJs Multi User Blogging Platform with SEO
kaloraat / react-node-next-multi-user-blogging-platform Goto Github PK
View Code? Open in Web Editor NEWReact Node NextJs Multi User Blogging Platform with SEO
React Node NextJs Multi User Blogging Platform with SEO
React Node NextJs Multi User Blogging Platform with SEO
When you open the window to login with facebook, but you close the window, it shows an error evety time you visit any part of the page
×
Unhandled Rejection (TypeError): Cannot read property 'error' of undefined
(anonymous function)
./components/auth/SignupComponent.js:24
21 | const user = { name, email, password };
22 |
23 | signup(user).then(data => {
24 | if (data.error) {
| ^ 25 | setValues({ ...values, error: data.error, loading: false });
26 | } else {
27 | setValues({
Unable to return the related blogs in the component.
Also tried { JSON.strigify(related) }
to debug the error which gives
{"related":[]}
The ERROR :
(anonymous function)
./pages/blogs/[slug].js:19 is returning error
17 | const loadRelated = () => {
18 | listRelated({blog}).then(data => {
> 19 | if (data.error) {
^ 20 | console.log(data.error);
21 | } else {
22 | setRelated(data);
Will you expand this or make into a real blogging creation platform site in future?
Maybe you can fork a version for the opensource community to contribute etc.
Please do that. Thanks.
Correct me if I'm wrong but if a hacker guesses an admin _id in the pubic db, he could gain access to all admin apis such as adding or deleting categories or tags. I believe a token should be used to access those restricted apis.
To list all blogs created by the specific user, isAuth()
from actions returns undefined value if it is used as const username = isAuth() && isAuth().username
.
The backend controller method is working perfectly fine, tried passing the user Id by manually typing it into the code and it works.
Repo Code
So it is not getting the value from LocalStorage
Could you tell me what license your code is using? Thanks
Cheers
Elliott
On reset password even though the new password is getting updated it does not allow to signin using the updated password.
This code Reset Password Controller is working fine , i tried result.password
to see the response which gives the new password that user types. But for some reasons it is not getting updated in database and only the resetPasswordLink
gets updated.
@kaloraat
53 |
55 |
{renderHTML(blog.excerpt)}
| ^
56 | <Link href={/blogs/${blog.slug}
}>
57 | Read more
58 |
your example (solution ) code is not working ㅡ.ㅡ I used promise and async/await but still not working... I don't know what problem is
`
const Blog = require('../models/blog');
const Category = require('../models/category');
const Tag = require('../models/tag');
const formidable = require('formidable');
const slugify = require('slugify');
const stripHtml = require('string-strip-html');
const _ = require('lodash');
const { errorHandler } = require('../helpers/dbErrorHandler');
const fs = require('fs');
exports.create = (req, res) => {
let form = new formidable.IncomingForm();
form.keepExtensions = true;
form.parse(req, (err, fields, files) => {
if (err) {
return res.status(400).json({
error: 'Image could not upload'
});
}
const { title, body, categories, tags } = fields;
if (!title || !title.length) {
return res.status(400).json({
error: 'title is required'
});
}
if (!body || body.length < 200) {
return res.status(400).json({
error: 'Content is too short'
});
}
if (!categories || categories.length === 0) {
return res.status(400).json({
error: 'At least one category is required'
});
}
if (!tags || tags.length === 0) {
return res.status(400).json({
error: 'At least one tag is required'
});
}
let blog = new Blog();
blog.title = title;
blog.body = body;
blog.slug = slugify(title).toLowerCase();
blog.mtitle = `${title} | ${process.env.APP_NAME}`;
blog.mdesc = stripHtml(body.substring(0, 160));
blog.postedBy = req.user._id;
// categories and tags
let arrayOfCategories = categories && categories.split(',');
let arrayOfTags = tags && tags.split(',');
if (files.photo) {
if (files.photo.size > 10000000) {
return res.status(400).json({
error: 'Image should be less then 1mb in size'
});
}
blog.photo.data = fs.readFileSync(files.photo.path);
blog.photo.contentType = files.photo.type;
}
blog.save((err, result) => {
if (err) {
return res.status(400).json({
error: errorHandler(err)
});
}
// res.json(result);
Blog.findByIdAndUpdate(result._id, { $push: { categories: arrayOfCategories } }, { new: true }).exec(
(err, result) => {
if (err) {
return res.status(400).json({
error: errorHandler(err)
});
} else {
Blog.findByIdAndUpdate(result._id, { $push: { tags: arrayOfTags } }, { new: true }).exec(
(err, result) => {
if (err) {
return res.status(400).json({
error: errorHandler(err)
});
} else {
res.json(result);
}
}
);
}
}
);
});
});
};
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.