replace axiosInstance in the Roles ListPage deleteData function to replace the api call with the getFetchClient del method

This commit is contained in:
Simone Taeggi 2023-01-05 12:36:59 +01:00
parent c7ba51012e
commit 492cfe13ce

View File

@ -1,5 +1,5 @@
import { getFetchClient } from '@strapi/admin/admin/src/utils/getFetchClient'; import { getFetchClient } from '@strapi/admin/admin/src/utils/getFetchClient';
import { getRequestURL, axiosInstance } from '../../../../utils'; import { getRequestURL } from '../../../../utils';
export const fetchData = async (toggleNotification, notifyStatus) => { export const fetchData = async (toggleNotification, notifyStatus) => {
try { try {
@ -20,7 +20,8 @@ export const fetchData = async (toggleNotification, notifyStatus) => {
export const deleteData = async (id, toggleNotification) => { export const deleteData = async (id, toggleNotification) => {
try { try {
await axiosInstance.delete(`${getRequestURL('roles')}/${id}`); const { del } = getFetchClient();
await del(`${getRequestURL('roles')}/${id}`);
} catch (error) { } catch (error) {
toggleNotification({ toggleNotification({
type: 'warning', type: 'warning',