Cleanup and renaming
This commit is contained in:
@@ -10,7 +10,7 @@ const responseBody = res => res.body;
|
||||
const setJwt = () => {
|
||||
const jwt = cookies.get('token');
|
||||
return jwt ? { 'Authorization': `JWT ${jwt}` } : {}
|
||||
}
|
||||
};
|
||||
|
||||
const requests = {
|
||||
get: (url, params) => {
|
||||
|
||||
@@ -18,7 +18,6 @@ export default User => ({
|
||||
user.authenticate(password, (authErr, model, passwordError) => {
|
||||
if (authErr || passwordError) return res.status(401).json({ message: 'Auth Failed' });
|
||||
|
||||
console.log('Correct password. Generating token.');
|
||||
let opts = {};
|
||||
opts.expiresIn = process.env.tokenExpiration || 7200; // 20min default expiration
|
||||
const secret = process.env.secret || 'SECRET_KEY';
|
||||
|
||||
@@ -21,7 +21,7 @@ function upload(req, res, next, config) {
|
||||
if (req.files.file.mimetype.split('/')[0] === 'image') {
|
||||
resize(config, req.files.file);
|
||||
}
|
||||
res.send('File uploaded.');
|
||||
res.status(200).send('File uploaded.');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ export default function internationalization(schema, options) {
|
||||
return value;
|
||||
})
|
||||
.set(function (value) {
|
||||
;
|
||||
// multiple locales are set as an object
|
||||
if (typeof value === 'object') {
|
||||
let locales = this.schema.options.mongooseIntl.locales;
|
||||
|
||||
@@ -4,7 +4,7 @@ const create = (req, res) => {
|
||||
req.model.setDefaultLocale(req.locale); // TODO - move to middleware
|
||||
req.model.create(req.body, (err, result) => {
|
||||
if (err)
|
||||
return res.send(httpStatus.INTERNAL_SERVER_ERROR, { error: err });
|
||||
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: err });
|
||||
|
||||
return res.status(httpStatus.CREATED)
|
||||
.json({
|
||||
|
||||
Reference in New Issue
Block a user