1234567891011121314151617181920212223242526272829 |
- import { put, call, all } from 'redux-saga/effects';
- import axios from 'axios';
- import { CREATE_ANSVERS } from '../../../constants/admin';
- import { getAnswersSuccess, getAnswersFailure} from '../../../actions/admin/changeTest/getAnswers';
- import storageKey from '../../../utils/storageKey';
- const getItem = localStorage.getItem(storageKey);
- export default function* ({payload:{value}}) {
- try {
-
- const config ={
- headers: {
- "Authorization": `Bearer ${getItem}`
- }
- }
-
- const answers = yield call(() =>
- axios.get(`${CREATE_ANSVERS}?question=${value}` ,config)
- )
- yield put(getAnswersSuccess(answers));
- }
- catch ({ message }) {
- yield put(getAnswersFailure(message));
- }
- }
|