fix: opts null

This commit is contained in:
chenos 2021-11-10 20:32:47 +08:00
parent f555a64a2d
commit 3cdff1adc8
3 changed files with 5 additions and 4 deletions

View File

@ -24,8 +24,8 @@ request.use(async (ctx, next) => {
const token = localStorage.getItem('NOCOBASE_TOKEN');
if (token) {
headers['Authorization'] = `Bearer ${token}`;
headers['X-Hostname'] = process.env.API_HOSTNAME;
}
headers['X-Hostname'] = window.location.hostname;
await next();
});

View File

@ -47,6 +47,7 @@ const api = new Server({
});
const plugins = [
'@nocobase/plugin-multi-apps',
'@nocobase/plugin-ui-router',
'@nocobase/plugin-ui-schema',
'@nocobase/plugin-collections',

View File

@ -92,9 +92,9 @@ export default {
}
},
});
this.app.on('db.init', async (opts, cli) => {
const importDemo = opts.importDemo || this.options.importDemo;
const lang = opts.lang || this.options.lang;
this.app.on('db.init', async (opts = {}, cli) => {
const importDemo = opts?.importDemo || this.options.importDemo;
const lang = opts?.lang || this.options.lang;
const SystemSetting = app.db.getModel('system_settings');
const model = await SystemSetting.findOne();
model.appLang = lang || 'en-US';