mirror of
https://github.com/strapi/strapi.git
synced 2025-09-17 04:17:21 +00:00
Add implementation using useFetchClient hook
This commit is contained in:
parent
745495a8d6
commit
96edc9816b
@ -25,7 +25,7 @@ import NotFoundPage from '../NotFoundPage';
|
||||
import UseCasePage from '../UseCasePage';
|
||||
import { getUID } from './utils';
|
||||
import routes from './utils/routes';
|
||||
import { useConfigurations } from '../../hooks';
|
||||
import { useConfigurations, useFetchClient } from '../../hooks';
|
||||
|
||||
const AuthenticatedApp = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin-authenticatedApp" */ '../../components/AuthenticatedApp')
|
||||
@ -37,6 +37,7 @@ function App() {
|
||||
const { formatMessage } = useIntl();
|
||||
const [{ isLoading, hasAdmin, uuid }, setState] = useState({ isLoading: true, hasAdmin: false });
|
||||
const appInfo = useAppInfos();
|
||||
const { get } = useFetchClient();
|
||||
|
||||
const authRoutes = useMemo(() => {
|
||||
return makeUniqueRoutes(
|
||||
@ -71,8 +72,6 @@ function App() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const currentToken = auth.getToken();
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const {
|
||||
@ -83,15 +82,11 @@ function App() {
|
||||
|
||||
updateProjectSettings({ menuLogo: prefixFileUrlWithBackendUrl(menuLogo) });
|
||||
|
||||
if (uuid && currentToken) {
|
||||
if (uuid) {
|
||||
const {
|
||||
data: { data: properties },
|
||||
} = await axios.get(`${strapi.backendURL}/admin/telemetry-properties`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${currentToken}`,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
} = await get(`/admin/telemetry-properties`, {
|
||||
validateStatus: (status) => status < 500,
|
||||
});
|
||||
|
||||
setTelemetryProperties(properties);
|
||||
|
Loading…
x
Reference in New Issue
Block a user