import { call, put } from 'redux-saga/effects';
import { get } from '@services/requests';
import { Api } from '@routes/Api';
import { handleError } from '@modules/error-handler';
import * as actions from '@lib/redux/actions/live-radio-actions';


export function* fetchLiveRadios(): Generator {
	try {
		const res: Record<string, any> = yield call(() => get({
			url: Api.radio
		}));

		yield put(actions.fetchedLiveRadios({ data: res.data }));

	}
	catch (error) {
		yield put(actions.failedFetchLiveRadios({ error: error.message }));

		handleError(error);
	}
}




