mirror of
https://github.com/strapi/strapi.git
synced 2025-07-28 11:30:21 +00:00
feat(menu-logo): added GET /project-settings route
This commit is contained in:
parent
d4c9cbfe47
commit
4c80b3f798
@ -48,6 +48,10 @@ module.exports = {
|
||||
return { data: { uuid, hasAdmin } };
|
||||
},
|
||||
|
||||
async getProjectSettings() {
|
||||
return getService('project-settings').getProjectSettings();
|
||||
},
|
||||
|
||||
async updateProjectSettings(ctx) {
|
||||
const projectSettingsService = getService('project-settings');
|
||||
|
||||
|
@ -7,6 +7,20 @@ module.exports = [
|
||||
handler: 'admin.init',
|
||||
config: { auth: false },
|
||||
},
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/project-settings',
|
||||
handler: 'admin.getProjectSettings',
|
||||
config: {
|
||||
policies: [
|
||||
'admin::isAuthenticatedAdmin',
|
||||
{
|
||||
name: 'admin::hasPermissions',
|
||||
config: { actions: ['admin::project-settings.update'] },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
method: 'POST',
|
||||
path: '/project-settings',
|
||||
|
@ -4,6 +4,9 @@ const fs = require('fs');
|
||||
const { pick } = require('lodash');
|
||||
|
||||
const PROJECT_SETTINGS_FILE_INPUTS = ['menuLogo'];
|
||||
const DEFAULT_PROJECT_SETTINGS = {
|
||||
menuLogo: null,
|
||||
};
|
||||
|
||||
const parseFilesData = async files => {
|
||||
const formatedFilesData = {};
|
||||
@ -52,7 +55,10 @@ const parseFilesData = async files => {
|
||||
|
||||
const getProjectSettings = async () => {
|
||||
const store = strapi.store({ type: 'core', name: 'admin' });
|
||||
const projectSettings = await store.get({ key: 'project-settings' });
|
||||
const projectSettings = {
|
||||
...DEFAULT_PROJECT_SETTINGS,
|
||||
...(await store.get({ key: 'project-settings' })),
|
||||
};
|
||||
|
||||
// Filter file input fields
|
||||
PROJECT_SETTINGS_FILE_INPUTS.forEach(inputName => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user