Protect telemetry properties route

This commit is contained in:
Christian Capeans 2022-12-07 14:21:58 +01:00
parent 141f89f81f
commit 19d88652e3
2 changed files with 11 additions and 3 deletions

View File

@ -71,6 +71,8 @@ function App() {
}, []); }, []);
useEffect(() => { useEffect(() => {
const currentToken = auth.getToken();
const getData = async () => { const getData = async () => {
try { try {
const { const {
@ -81,10 +83,16 @@ function App() {
updateProjectSettings({ menuLogo: prefixFileUrlWithBackendUrl(menuLogo) }); updateProjectSettings({ menuLogo: prefixFileUrlWithBackendUrl(menuLogo) });
if (uuid) { if (uuid && currentToken) {
const { const {
data: { data: properties }, data: { data: properties },
} = await axios.get(`${strapi.backendURL}/admin/telemetry-properties`); } = await axios.get(`${strapi.backendURL}/admin/telemetry-properties`, {
headers: {
Authorization: `Bearer ${currentToken}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
});
setTelemetryProperties(properties); setTelemetryProperties(properties);

View File

@ -54,7 +54,7 @@ module.exports = [
path: '/telemetry-properties', path: '/telemetry-properties',
handler: 'admin.telemetryProperties', handler: 'admin.telemetryProperties',
config: { config: {
auth: false, policies: ['admin::isAuthenticatedAdmin'],
}, },
}, },
{ {