Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/backend/node_modules/strapi-admin/admin/src/hooks/useRolesList/index.js
Назад
import { useEffect, useReducer } from 'react'; import { request } from 'strapi-helper-plugin'; import { get } from 'lodash'; import init from './init'; import reducer, { initialState } from './reducer'; const useRolesList = (shouldFetchData = true) => { const [{ roles, isLoading }, dispatch] = useReducer(reducer, initialState, () => init(initialState, shouldFetchData) ); useEffect(() => { if (shouldFetchData) { fetchRolesList(); } }, [shouldFetchData]); const fetchRolesList = async () => { try { dispatch({ type: 'GET_DATA', }); const { data } = await request('/admin/roles', { method: 'GET' }); dispatch({ type: 'GET_DATA_SUCCEEDED', data, }); } catch (err) { const message = get(err, ['response', 'payload', 'message'], 'An error occured'); dispatch({ type: 'GET_DATA_ERROR', }); if (message !== 'Forbidden') { strapi.notification.toggle({ type: 'warning', message, }); } } }; return { roles, isLoading, getData: fetchRolesList }; }; export default useRolesList;
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка