redux-saga/effects#takeLatest JavaScript Examples
The following examples show how to use
redux-saga/effects#takeLatest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js From Alfredo-Mobile with MIT License | 6 votes |
/* ------------- Connect Types To Sagas ------------- */
export default function * root () {
yield all([
// some sagas only receive an action
takeLatest(StartupTypes.STARTUP, startup, api),
takeLatest(ProductsTypes.GET_PRODUCTS_REQUEST, getProducts, api),
takeLatest(ProductsTypes.MORE_PRODUCTS_REQUEST, moreProducts, api),
takeLatest(ProductsTypes.GET_DETAIL_REQUEST, getDetail, api),
takeLatest(CategoryTypes.GET_CATEGORY_REQUEST, getCategory, api),
takeLatest(CategoryTypes.SHOW_CATEGORY_REQUEST, showCategory, api),
takeLatest(AuthTypes.DO_LOGIN_REQUEST, doLogin, api),
takeLatest(AuthTypes.DO_REGISTER_REQUEST, doRegister, api),
takeLatest(AuthTypes.DO_LOGOUT_REQUEST, doLogout, api),
takeLatest(SessionTypes.GET_PROFILE_REQUEST, getProfile, api),
takeLatest(InvoiceTypes.GET_INVOICE_REQUEST, getInvoice, api),
takeLatest(InvoiceTypes.MORE_INVOICE_REQUEST, moreInvoice, api),
takeLatest(InvoiceTypes.SHOW_INVOICE_REQUEST, showInvoice, api),
takeLatest(OrderTypes.MAKE_ORDER_REQUEST, makeOrder, api),
takeLatest(ConfirmPaymentTypes.CONFIRM_PAYMENT_REQUEST, confirmPayment, api)
])
}
Example #2
Source File: saga.js From QiskitFlow with Apache License 2.0 | 6 votes |
/**
* Root saga manages watcher lifecycle
*/
export default function* githubData() {
// Watches for LOAD_REPOS actions and calls getRepos when one comes in.
// By using `takeLatest` only the result of the latest API call is applied.
// It returns task descriptor (just like fork) so we can continue execution
// It will be cancelled automatically on component unmount
yield takeLatest(LOAD_REPOS, getRepos);
}
Example #3
Source File: chat.js From haven with MIT License | 6 votes |
export default function* Chat() {
yield takeEvery(chatActions.fetchChats, getChats);
yield takeEvery(chatActions.updateChats, updateChats);
yield takeEvery(chatActions.fetchChatDetail, getChatDetail);
yield takeEvery(chatActions.sendChat, sendChat);
yield takeLatest(chatActions.sendChat, sendChatNotification);
yield takeEvery(chatActions.setChatAsRead, setChatAsRead);
yield takeEvery(chatActions.deleteChatConversation, deleteChatConversation);
}
Example #4
Source File: albums.sagas.js From react-redux-jsonplaceholder with MIT License | 6 votes |
//Not necessary unless you have more than one sagas exports
//The array should contain a list of actions to be listened to
export default function* albumsSaga() {
yield takeLatest(AlbumsActionTypes.ADD_ALBUM_START, addAlbumStartAsync);
yield takeLatest(AlbumsActionTypes.EDIT_ALBUM_START, editAlbumStartAsync);
yield takeLatest(AlbumsActionTypes.DELETE_ALBUM_START, deleteAlbumStateAsync);
yield takeLatest(AlbumsActionTypes.FETCH_ALBUMS_START, fetchAlbumsStartAsync);
yield takeLatest(
[
AlbumsActionTypes.DELETE_ALBUM_FAILURE,
AlbumsActionTypes.DELETE_ALBUM_SUCCESS,
AlbumsActionTypes.ADD_ALBUM_FAILURE,
AlbumsActionTypes.ADD_ALBUM_SUCCESS,
AlbumsActionTypes.EDIT_ALBUM_FAILURE,
AlbumsActionTypes.EDIT_ALBUM_SUCCESS,
AlbumsActionTypes.FETCH_ALBUMS_FAILURE,
AlbumsActionTypes.FETCH_ALBUMS_SUCCESS,
],
clearAlbumMessagesStart
);
}
Example #5
Source File: user.js From full-stack-fastapi-react-postgres-boilerplate with MIT License | 6 votes |
/**
* User Sagas
*/
export default function* root() {
yield all([
takeLatest(ActionTypes.USER_LOGIN, login),
takeLatest(ActionTypes.USER_LOGOUT, logout),
]);
}
Example #6
Source File: index.js From gDoctor with MIT License | 6 votes |
/* ------------- Connect Types To Sagas ------------- */
export default function * root () {
yield all([
// some sagas only receive an action
takeLatest(StartupTypes.STARTUP, startup),
// some sagas receive extra parameters in addition to an action
takeLatest(GithubTypes.USER_REQUEST, getUserAvatar, api)
])
}
Example #7
Source File: saga.js From bank-client with MIT License | 6 votes |
export default function* loginPageSaga() {
yield takeLatest(LOGOUT_REQUEST, logout);
yield takeLatest(GET_CURRENCIES_REQUEST, getCurrencies);
yield takeLatest(CHECK_EMAIL_REQUEST, checkEmail);
yield takeLatest(GET_MESSAGES_REQUEST, getMessages);
yield takeLatest(READ_ALL_MESSAGES_REQUEST, readAllMessages);
yield takeLatest(OPEN_MESSAGE_MODAL, openMessageModal);
yield takeLatest(GET_NOTIFICATIONS_REQUEST, getNotifications);
}
Example #8
Source File: saga.js From rysolv with GNU Affero General Public License v3.0 | 6 votes |
export default function* watcherSaga() {
yield takeLatest(FETCH_ACTIVE_USER, fetchActiveUserSaga);
yield takeLatest(GITHUB_SIGN_IN, githubSignInSaga);
yield takeLatest(RESEND_CODE, resendCodeSaga);
yield takeLatest(RESEND_SIGN_UP, resendSignUpSaga);
yield takeLatest(RESET_PASSWORD, resetPasswordSaga);
yield takeLatest(SEND_LINK, sendLinkSaga);
yield takeLatest(SIGN_IN, signInSaga);
yield takeLatest(SIGN_OUT, signOutSaga);
yield takeLatest(SIGN_UP, signUpSaga);
yield takeLatest(VERIFY_EMAIL, verifyEmailSaga);
}
Example #9
Source File: effect.js From lrc-staking-dapp with MIT License | 6 votes |
export default function* () {
yield all([
takeLatest(STAKING_GET_STAKE_LIST, fetchEventStackedList),
takeLatest(STAKING_GET_TOTAL_STAKE, fetchTotalStake),
takeLatest(STAKING_GET_YOUR_STAKE, fetchYourStake),
takeLatest(STAKING_DO_STAKE, doStake),
takeLatest(STAKING_DO_CLAIM, doClaim),
takeLatest(STAKING_DO_WITHDRAW, doWithdraw),
]);
}
Example #10
Source File: saga.js From QiskitFlow with Apache License 2.0 | 5 votes |
export default function* runList() {
yield takeLatest(SET_PAGE, getRuns);
yield takeLatest(SET_FILTER_DATE_START, getRuns);
yield takeLatest(SET_FILTER_DATE_END, getRuns);
yield takeLatest(SET_FILTER_QUERY, getRuns);
yield takeLatest(GET_RUNS, getRuns);
}
Example #11
Source File: authenticateAPI.js From cra-template-redux-auth-starter with MIT License | 5 votes |
export default function* rootSaga() {
yield all([takeLatest(login, loginAPI)]);
}
Example #12
Source File: search.js From haven with MIT License | 5 votes |
SearchSaga = function* Search() {
yield takeLatest(actions.doSearch, fetchSearchResult);
yield takeLatest(actions.doSearchUser, fetchUserSearchResult);
yield takeLatest(actions.appendSearch, fetchSearchResult);
yield takeLatest(actions.appendUserSearch, fetchUserSearchResult);
yield takeEvery(actions.updateFilter, updateFilter);
}
Example #13
Source File: settingsSagas.js From NextcloudDuplicateFinder with GNU Affero General Public License v3.0 | 5 votes |
function * watchForView () {
yield takeLatest(reducerConstants.app.f.VIEW_LOADED, loadSettings)
}
Example #14
Source File: DecrCountSaga.js From react-enterprise-starter-kit with MIT License | 5 votes |
export default function* watchDecrementCountSaga() {
yield takeLatest(DECREMENT, decrementUserCountSaga);
}
Example #15
Source File: Follower.Saga.js From react-native-hook-template with MIT License | 5 votes |
export function* watchGetFollower() {
yield takeLatest(GET_FOLLOWER_REQUEST, handleGetFollower);
}
Example #16
Source File: saga.js From awsboilerplate with MIT License | 5 votes |
/**
* Root saga manages watcher lifecycle
*/
export default function* launchBackgroundTask() {
yield takeEvery(SAY_HELLO_REQUEST, sayHello);
yield takeEvery(BACKGROUND_JOB_SUBMIT, submitBackgroundJob);
yield takeLatest(BACKGROUND_JOB_STATUS_POLL, getBackgroundJobStatus);
}
Example #17
Source File: saga.js From hackchat-client with Do What The F*ck You Want To Public License | 5 votes |
export default function* communicationProviderSaga() {
const client = yield call(initWebsocket);
// Channel Actions
yield takeLatest(START_JOIN, (action) =>
hcClient.join(action.username, action.password, action.channel),
);
yield takeLatest(SEND_CHAT, (action) =>
hcClient.say(action.channel, action.message),
);
yield takeLatest(ENABLE_CAPTCHA, (action) =>
hcClient.enableCaptcha(action.channel),
);
yield takeLatest(DISABLE_CAPTCHA, (action) =>
hcClient.disableCaptcha(action.channel),
);
yield takeLatest(LOCK_CHANNEL, (action) =>
hcClient.lockChannel(action.channel),
);
yield takeLatest(UNLOCK_CHANNEL, (action) =>
hcClient.unlockChannel(action.channel),
);
// User Actions
yield takeLatest(INVITE_USER, (action) =>
action.user.sendInvite(action.channel),
);
yield takeLatest(WHISPER_USER, (action) =>
hcClient.say(action.channel, 'I wish the developer wasnt so lazy. . .'),
);
yield takeLatest(IGNORE_USER, (action) => action.user.toggleBlock());
yield takeLatest(KICK_USER, (action) => action.user.kick(action.channel));
yield takeLatest(BAN_USER, (action) => action.user.ban(action.channel));
yield takeLatest(MUTE_USER, (action) => action.user.mute(action.channel));
yield takeLatest(UNMUTE_USER, (action) => action.user.unmute(action.channel));
while (true) {
const action = yield take(client);
yield put(action);
}
}
Example #18
Source File: app.js From full-stack-fastapi-react-postgres-boilerplate with MIT License | 5 votes |
/**
* App Sagas
*/
export default function* root() {
yield all([takeLatest(ActionTypes.SWITCH_MENU, switchMenu)]);
}
Example #19
Source File: sagas.js From what-front with MIT License | 5 votes |
function* loginWatcher() {
yield takeLatest(actionTypes.LOGIN_REQUESTING, loginWorker);
}
Example #20
Source File: user.js From ant-simple-pro with MIT License | 5 votes |
export default function* users() {
yield takeEvery(SAGA.SAGA_GETMENUTREE, effects.getMenTree);
yield takeLatest(SAGA.SAGA_GETMENULIST, effects.getMenuList);
yield takeLatest(SAGA.SAGA_GET_USER_LIST, effects.getUserData);
yield takeEvery(SAGA.SAGA_GET_USER_INFO, effects.getUserInfoData);
}
Example #21
Source File: index.js From iitj-canteen with GNU General Public License v3.0 | 5 votes |
export default function* root() {
yield all([
takeLatest(AuthActionTypes.FETCH_USER, fetchUser),
takeLatest(AuthActionTypes.SIGN_IN_USER, signInUser),
takeLatest(AuthActionTypes.SIGN_OUT_USER, signoutUser)
]);
}
Example #22
Source File: saga.js From bank-client with MIT License | 5 votes |
export default function* dashboardPageSaga() {
yield takeLatest(GET_AVAILABLE_FUNDS_REQUEST, getAvailableFunds);
yield takeLatest(GET_ACCOUNT_BALANCE_REQUEST, getAccountBalance);
yield takeLatest(GET_BILLS_REQUEST, getBills);
yield takeLatest(GET_RECENT_TRANSACTIONS_REQUEST, getRecentTransactions);
yield takeLatest(CREATE_NEW_BILL_REQUEST, createNewBill);
}
Example #23
Source File: sagas.js From one-wallet with Apache License 2.0 | 5 votes |
function * walletSages () {
yield all([
takeLatest(cacheActions.fetchCode().type, handleFetchCode),
takeLatest(cacheActions.fetchVersion().type, handleFetchVersion),
takeLatest(cacheActions.fetchGlobalStats().type, handleFetchGlobalStats),
])
}
Example #24
Source File: saga.js From rysolv with GNU Affero General Public License v3.0 | 5 votes |
export default function* watcherSaga() {
yield takeLatest(FETCH_COMPANY, fetchCompanySaga);
yield takeLatest(FETCH_POSITION_DETAIL, fetchPositionDetailSaga);
yield takeLatest(NOTIFY_COMPANY, notifyCompanySaga);
}
Example #25
Source File: cart.sagas.js From CodeSignal-Practice_Solutions with MIT License | 5 votes |
export function* onSignOutSuccess() {
yield takeLatest(UserActionTypes.SIGN_OUT_SUCCESS, clearCartOnSignOut);
}