mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 16:23:37 +08:00
17 lines
393 B
JavaScript
17 lines
393 B
JavaScript
export default function saveSettings(settings) {
|
|
const oldSettings = JSON.parse(JSON.stringify(app.data.settings));
|
|
|
|
Object.assign(app.data.settings, settings);
|
|
|
|
return app
|
|
.request({
|
|
method: 'POST',
|
|
url: app.forum.attribute('apiUrl') + '/settings',
|
|
data: settings,
|
|
})
|
|
.catch((error) => {
|
|
app.data.settings = oldSettings;
|
|
throw error;
|
|
});
|
|
}
|