mirror of
https://github.com/flarum/core.git
synced 2025-10-14 00:15:51 +02:00
Allow custom variables to be set on the client app
This commit is contained in:
14
js/admin/src/utils/saveConfig.js
Normal file
14
js/admin/src/utils/saveConfig.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export default function saveConfig(config) {
|
||||
const oldConfig = JSON.parse(JSON.stringify(app.config));
|
||||
|
||||
Object.assign(app.config, config);
|
||||
|
||||
return app.request({
|
||||
method: 'POST',
|
||||
url: app.forum.attribute('adminUrl') + '/config',
|
||||
data: {config}
|
||||
}).catch(error => {
|
||||
app.config = oldConfig;
|
||||
throw error;
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user