當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript react-router-redux.push函數代碼示例

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

    }
  }
}
開發者ID:,項目名稱:,代碼行數:59,代碼來源:

示例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('/'));
    }
}
開發者ID:hwkns,項目名稱:streisand,代碼行數:10,代碼來源:DeleteReleaseAction.ts

示例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;
   }
 }),
開發者ID:Leonardo-mbc,項目名稱:Sound-Walker,代碼行數:13,代碼來源:music-select-saga.ts

示例4: dispatch

 .then(function(response: any) {
     if(response.services)
     {
         dispatch(addedService(response.services))
         dispatch(push('/'))
     }
 })
開發者ID:nyamteam,項目名稱:web-client,代碼行數:7,代碼來源:serviceAction.ts

示例5: received

function* received(response: IInviteResponse, props: IActionProps) {
    yield put<Action>({
        type: 'RECEIVED_NEW_INVITE',
        invite: transformInvite(response)
    });
    yield put(push(`/invites/1`));
}
開發者ID:hwkns,項目名稱:streisand,代碼行數:7,代碼來源:CreateInviteAction.ts

示例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()))
    }
  }
}
開發者ID:influxdata,項目名稱:influxdb,代碼行數:27,代碼來源:index.ts

示例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()))
  }
}
開發者ID:sebito91,項目名稱:influxdb,代碼行數:35,代碼來源:orgs.ts

示例8: async

export const goToTasks = () => async (dispatch, getState: GetStateFunc) => {
  const {
    orgs: {org},
  } = getState()

  dispatch(push(`/orgs/${org.id}/tasks`))
}
開發者ID:sebito91,項目名稱:influxdb,代碼行數:7,代碼來源:index.ts

示例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'));
    }
}
開發者ID:hwkns,項目名稱:streisand,代碼行數:8,代碼來源:DeleteWikiAction.ts


注:本文中的react-router-redux.push函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。