mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix(#9315): api v3 post, put, del JSON
also allow `app.alertError` to be called without an argument also fix `./nodebb build --dev` to actually build in dev mode
This commit is contained in:
committed by
Julian Lam
parent
c5231f10ff
commit
0d59fe3d2b
@@ -179,7 +179,7 @@ app.cacheBuster = null;
|
||||
};
|
||||
|
||||
app.alertError = function (message, timeout) {
|
||||
message = message.message || message;
|
||||
message = (message && message.message) || message;
|
||||
|
||||
if (message === '[[error:invalid-session]]') {
|
||||
app.handleInvalidSession();
|
||||
|
||||
@@ -55,7 +55,8 @@ define('api', () => {
|
||||
api.post = (route, payload, onSuccess) => call({
|
||||
url: route,
|
||||
method: 'post',
|
||||
data: payload,
|
||||
data: JSON.stringify(payload),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
headers: {
|
||||
'x-csrf-token': config.csrf_token,
|
||||
},
|
||||
@@ -64,7 +65,8 @@ define('api', () => {
|
||||
api.put = (route, payload, onSuccess) => call({
|
||||
url: route,
|
||||
method: 'put',
|
||||
data: payload,
|
||||
data: JSON.stringify(payload),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
headers: {
|
||||
'x-csrf-token': config.csrf_token,
|
||||
},
|
||||
@@ -73,7 +75,8 @@ define('api', () => {
|
||||
api.del = (route, payload, onSuccess) => call({
|
||||
url: route,
|
||||
method: 'delete',
|
||||
data: payload,
|
||||
data: JSON.stringify(payload),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
headers: {
|
||||
'x-csrf-token': config.csrf_token,
|
||||
},
|
||||
|
||||
@@ -95,10 +95,6 @@ nconf.argv(opts).env({
|
||||
separator: '__',
|
||||
});
|
||||
|
||||
const env = program.dev ? 'development' : (process.env.NODE_ENV || 'production');
|
||||
process.env.NODE_ENV = env;
|
||||
global.env = env;
|
||||
|
||||
prestart.setupWinston();
|
||||
|
||||
// Alternate configuration file support
|
||||
@@ -197,6 +193,10 @@ program
|
||||
.description(`Compile static assets ${'(JS, CSS, templates, languages)'.red}`)
|
||||
.option('-s, --series', 'Run builds in series without extra processes')
|
||||
.action((targets, options) => {
|
||||
if (program.dev) {
|
||||
process.env.NODE_ENV = 'development';
|
||||
global.env = 'development';
|
||||
}
|
||||
require('./manage').build(targets.length ? targets : true, options);
|
||||
})
|
||||
.on('--help', () => {
|
||||
|
||||
Reference in New Issue
Block a user