12345678910111213141516171819202122232425262728 |
- import { put, call } from 'redux-saga/effects';
- import axios from 'axios';
- import { CREATE_TOPICS } from '../../../constants/admin';
- import { deleteTopicSuccess, deleteTopicFailure } from '../../../actions/admin/changeTest/deleteTopic';
- import storageKey from '../../../utils/storageKey';
- const getItem = localStorage.getItem(storageKey);
- export default function* ({payload:{topicId}}) {
- try {
- const config = {
- headers: {
- "Authorization": `Bearer ${getItem}`
- }
- }
- const category = yield call(() =>
- axios.delete(`${CREATE_TOPICS}${'/'}${topicId}`, config)
-
- )
- yield put(deleteTopicSuccess(category));
- }
- catch ({ message }) {
- yield put(deleteTopicFailure(message));
- }
- }
|