本文整理汇总了TypeScript中react-router-redux.push函数的典型用法代码示例。如果您正苦于以下问题:TypeScript push函数的具体用法?TypeScript push怎么用?TypeScript push使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了push函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: loginFlow
export function* loginFlow() {
window.beforeLogin = '/';
let previousSession = null;
yield take(LOCATION_CHANGE);
while (true) { // eslint-disable-line no-constant-condition
console.log('while true ', new Date());
const session = authAgent.getSession();
let location = yield select(makeSelectLocation());
location = location.pathname;
if (session !== null)
{
if (session !== previousSession) {
yield put({type: AUTHENTICATED});
}
if (previousSession === null) {
console.log('writing new session');
previousSession = session;
}
console.log('Session:', session);
if (location === '/login')
{
if (window.beforeLogin === '/login' || window.beforeLogin === '/logout')
window.beforeLogin = '/';
yield put(push(window.beforeLogin))
}
else
{
window.beforeLogin = location;
}
yield take(LOGOUT);
try {
yield call([authAgent,authAgent.logout]);
yield put({type : LOGGED_OUT});
}
catch (e)
{
console.log('logout error!', e);
}
}
else
{
if (location !== '/login') {
window.beforeLogin = location;
yield put(push('/login'));
}
const { login, password} = yield take(AUTH);
try { //context call
yield call([authAgent,authAgent.auth], login, password);
}
catch(e)
{
console.log('login error!',e);
}
}
}
}
示例2: received
function* received(response: void, props: IActionProps) {
yield put<Action>({ type: 'RECEIVED_RELEASE_DELETION', props });
if (props.currentPage) {
yield put(invalidate({ page: props.currentPage }));
} else if (props.film) {
yield put(push(`/films/${props.film}`));
} else {
yield put(push('/'));
}
}
示例3: takeEvery
takeEvery(MusicSelectAction.GO_TO_PLAYER, function*(
action: MusicSelectAction.GoToPlayer
) {
// yield delay(800);
switch (action.payload.mode) {
case MUSIC_SELECT_PLAY:
yield put(push(`/player/${action.payload.musicId}`));
break;
case MUSIC_SELECT_DJ_MODE:
yield put(push(`/dj-player/${action.payload.musicId}`));
break;
}
}),
示例4: dispatch
.then(function(response: any) {
if(response.services)
{
dispatch(addedService(response.services))
dispatch(push('/'))
}
})
示例5: received
function* received(response: IInviteResponse, props: IActionProps) {
yield put<Action>({
type: 'RECEIVED_NEW_INVITE',
invite: transformInvite(response)
});
yield put(push(`/invites/1`));
}
示例6: async
export const cloneDashboard = (dashboard: Dashboard) => async (
dispatch,
getState: GetState
): Promise<void> => {
try {
const {
orgs: {org},
dashboards,
} = getState()
const allDashboardNames = dashboards.list.map(d => d.name)
const clonedName = incrementCloneName(allDashboardNames, dashboard.name)
const data = await client.dashboards.clone(dashboard.id, clonedName, org.id)
dispatch(checkDashboardLimits())
dispatch(push(`/orgs/${org.id}/dashboards/${data.id}`))
} catch (error) {
console.error(error)
if (isLimitError(error)) {
dispatch(notify(copy.resourceLimitReached('dashboards')))
} else {
dispatch(notify(copy.dashboardCreateFailed()))
}
}
}
示例7: async
) => async (
dispatch: Dispatch<Actions | RouterAction | PublishNotificationAction>
) => {
let createdOrg: Organization
try {
createdOrg = await client.organizations.create(org)
await client.templates.create({
...defaultTemplates.systemTemplate(),
orgID: createdOrg.id,
})
await client.templates.create({
...defaultTemplates.gettingStartedWithFluxTemplate(),
orgID: createdOrg.id,
})
dispatch(notify(orgCreateSuccess()))
dispatch(addOrg(createdOrg))
dispatch(push(`/orgs/${createdOrg.id}`))
await client.buckets.create({
...bucket,
organizationID: createdOrg.id,
})
dispatch(notify(bucketCreateSuccess()))
} catch (e) {
console.error(e)
if (!createdOrg) {
dispatch(notify(orgCreateFailed()))
}
dispatch(notify(bucketCreateFailed()))
}
}
示例8: async
export const goToTasks = () => async (dispatch, getState: GetStateFunc) => {
const {
orgs: {org},
} = getState()
dispatch(push(`/orgs/${org.id}/tasks`))
}
示例9: received
function* received(response: void, props: IActionProps) {
yield put<Action>({ type: 'RECEIVED_WIKI_DELETION', props });
if (props.currentPage) {
yield put(invalidate({ page: props.currentPage }));
} else {
yield put(push('/wikis/1'));
}
}