本文整理匯總了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'));
}
}