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


TypeScript util.REQUEST方法代碼示例

本文整理匯總了TypeScript中app/shared/reducers/action-type.util.REQUEST方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript util.REQUEST方法的具體用法?TypeScript util.REQUEST怎麽用?TypeScript util.REQUEST使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app/shared/reducers/action-type.util的用法示例。


在下文中一共展示了util.REQUEST方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: default

// Reducer
export default (state: SettingsState = initialState, action): SettingsState => {
  switch (action.type) {
    case REQUEST(ACTION_TYPES.UPDATE_ACCOUNT):
      return {
        ...state,
        errorMessage: null,
        updateSuccess: false,
        loading: true
      };
    case FAILURE(ACTION_TYPES.UPDATE_ACCOUNT):
      return {
        ...state,
        loading: false,
        updateSuccess: false,
        updateFailure: true
      };
    case SUCCESS(ACTION_TYPES.UPDATE_ACCOUNT):
      return {
        ...state,
        loading: false,
        updateSuccess: true,
        updateFailure: false
      };
    case ACTION_TYPES.RESET:
      return {
        ...initialState
      };
    default:
      return state;
  }
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:32,代碼來源:settings.reducer.ts

示例2: default

// Reducer
export default (state: RegisterState = initialState, action): RegisterState => {
  switch (action.type) {
    case REQUEST(ACTION_TYPES.CREATE_ACCOUNT):
      return {
        ...state,
        loading: true
      };
    case FAILURE(ACTION_TYPES.CREATE_ACCOUNT):
      return {
        ...initialState,
        registrationFailure: true,
        errorMessage: action.payload.response.data.errorKey
      };
    case SUCCESS(ACTION_TYPES.CREATE_ACCOUNT):
      return {
        ...initialState,
        registrationSuccess: true
      };
    case ACTION_TYPES.RESET:
      return {
        ...initialState
      };
    default:
      return state;
  }
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:27,代碼來源:register.reducer.ts

示例3: it

 it('should detect a request', () => {
   const toTest = account(undefined, { type: REQUEST(ACTION_TYPES.UPDATE_ACCOUNT) });
   expect(toTest).toMatchObject({
     updateSuccess: false,
     updateFailure: false,
     loading: true
   });
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:8,代碼來源:settings.reducer.spec.ts

示例4: it

 it('should set state to updating', () => {
   testMultipleTypes(
     [
       REQUEST(ACTION_TYPES.CREATE_FLOCKRELATION),
       REQUEST(ACTION_TYPES.UPDATE_FLOCKRELATION),
       REQUEST(ACTION_TYPES.DELETE_FLOCKRELATION)
     ],
     {},
     state => {
       expect(state).toMatchObject({
         errorMessage: null,
         updateSuccess: false,
         updating: true
       });
     }
   );
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:17,代碼來源:flock-relation-reducer.spec.ts

示例5: it

 it('dispatches FETCH_LOGS_CHANGE_LEVEL_PENDING and FETCH_LOGS_CHANGE_LEVEL_FULFILLED actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.FETCH_LOGS_CHANGE_LEVEL)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_LOGS_CHANGE_LEVEL),
       payload: resolvedObject
     },
     {
       type: REQUEST(ACTION_TYPES.FETCH_LOGS)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_LOGS),
       payload: resolvedObject
     }
   ];
   await store.dispatch(changeLogLevel('ROOT', 'DEBUG')).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:19,代碼來源:administration.reducer.spec.ts

示例6: it

 it('dispatches DELETE_USER_PENDING and DELETE_USER_FULFILLED actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.DELETE_USER)
     },
     {
       type: SUCCESS(ACTION_TYPES.DELETE_USER),
       payload: resolvedObject
     },
     {
       type: REQUEST(ACTION_TYPES.FETCH_USERS)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_USERS),
       payload: resolvedObject
     }
   ];
   await store.dispatch(deleteUser('admin')).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:19,代碼來源:user-management.reducer.spec.ts

示例7: it

 it('dispatches ACTION_TYPES.CREATE_DIALOGUE actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.CREATE_DIALOGUE)
     },
     {
       type: SUCCESS(ACTION_TYPES.CREATE_DIALOGUE),
       payload: resolvedObject
     },
     {
       type: REQUEST(ACTION_TYPES.FETCH_DIALOGUE_LIST)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_DIALOGUE_LIST),
       payload: resolvedObject
     }
   ];
   await store.dispatch(createEntity({ id: 1 })).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:19,代碼來源:dialogue-reducer.spec.ts

示例8: it

 it('dispatches ACTION_TYPES.UPDATE_CUSTOMER actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.UPDATE_CUSTOMER)
     },
     {
       type: SUCCESS(ACTION_TYPES.UPDATE_CUSTOMER),
       payload: resolvedObject
     },
     {
       type: REQUEST(ACTION_TYPES.FETCH_CUSTOMER_LIST)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_CUSTOMER_LIST),
       payload: resolvedObject
     }
   ];
   await store.dispatch(updateEntity({ id: 1 })).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:19,代碼來源:customer-reducer.spec.ts

示例9: it

 it('dispatches ACTION_TYPES.FETCH_HISTORYMESSAGE actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.FETCH_HISTORYMESSAGE)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_HISTORYMESSAGE),
       payload: resolvedObject
     }
   ];
   await store.dispatch(getEntity(42666)).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
開發者ID:gjik911,項目名稱:git_01,代碼行數:12,代碼來源:history-message-reducer.spec.ts


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