mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 17:26:11 +00:00
update ConfigurationsProvider with new logo
This commit is contained in:
parent
681f095455
commit
c2605de89a
@ -12,6 +12,7 @@ import {
|
|||||||
request,
|
request,
|
||||||
useNotification,
|
useNotification,
|
||||||
TrackingContext,
|
TrackingContext,
|
||||||
|
prefixFileUrlWithBackendUrl,
|
||||||
} from '@strapi/helper-plugin';
|
} from '@strapi/helper-plugin';
|
||||||
import { SkipToContent } from '@strapi/design-system/Main';
|
import { SkipToContent } from '@strapi/design-system/Main';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
@ -71,7 +72,7 @@ function App() {
|
|||||||
data: { hasAdmin, uuid, menuLogo },
|
data: { hasAdmin, uuid, menuLogo },
|
||||||
} = await request('/admin/init', { method: 'GET' });
|
} = await request('/admin/init', { method: 'GET' });
|
||||||
|
|
||||||
setCustomLogo(menuLogo, 'menu');
|
setCustomLogo(prefixFileUrlWithBackendUrl(menuLogo), 'menu');
|
||||||
|
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
try {
|
try {
|
||||||
|
@ -17,6 +17,7 @@ import { Link } from '@strapi/design-system/Link';
|
|||||||
import { Button } from '@strapi/design-system/Button';
|
import { Button } from '@strapi/design-system/Button';
|
||||||
import ExternalLink from '@strapi/icons/ExternalLink';
|
import ExternalLink from '@strapi/icons/ExternalLink';
|
||||||
import Check from '@strapi/icons/Check';
|
import Check from '@strapi/icons/Check';
|
||||||
|
import { useConfigurations } from '../../../../hooks';
|
||||||
import Form from './components/Form';
|
import Form from './components/Form';
|
||||||
import { fetchProjectSettings, updateProjectSettings } from './utils/api';
|
import { fetchProjectSettings, updateProjectSettings } from './utils/api';
|
||||||
import { getFormData } from './utils/getFormData';
|
import { getFormData } from './utils/getFormData';
|
||||||
@ -30,6 +31,10 @@ const ApplicationInfosPage = () => {
|
|||||||
useFocusWhenNavigate();
|
useFocusWhenNavigate();
|
||||||
const appInfos = useAppInfos();
|
const appInfos = useAppInfos();
|
||||||
const { shouldUpdateStrapi, latestStrapiReleaseTag, strapiVersion } = appInfos;
|
const { shouldUpdateStrapi, latestStrapiReleaseTag, strapiVersion } = appInfos;
|
||||||
|
const {
|
||||||
|
setCustomLogo,
|
||||||
|
logos: { menu },
|
||||||
|
} = useConfigurations();
|
||||||
|
|
||||||
const { data } = useQuery('project-settings', fetchProjectSettings);
|
const { data } = useQuery('project-settings', fetchProjectSettings);
|
||||||
|
|
||||||
@ -38,8 +43,9 @@ const ApplicationInfosPage = () => {
|
|||||||
: 'app.components.UpgradePlanModal.text-ee';
|
: 'app.components.UpgradePlanModal.text-ee';
|
||||||
|
|
||||||
const submitMutation = useMutation(body => updateProjectSettings(body), {
|
const submitMutation = useMutation(body => updateProjectSettings(body), {
|
||||||
onSuccess: async () => {
|
onSuccess: async ({ menuLogo }) => {
|
||||||
await queryClient.invalidateQueries('project-settings', { refetchActive: true });
|
await queryClient.invalidateQueries('project-settings', { refetchActive: true });
|
||||||
|
setCustomLogo(menuLogo?.url || menu.default, 'menu');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ const fetchProjectSettings = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateProjectSettings = async body => {
|
const updateProjectSettings = async body => {
|
||||||
await axiosInstance.post('/admin/project-settings', body);
|
const { data } = await axiosInstance.post('/admin/project-settings', body);
|
||||||
|
|
||||||
|
return prefixAllUrls(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { fetchProjectSettings, updateProjectSettings };
|
export { fetchProjectSettings, updateProjectSettings };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user