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


TypeScript react-jhipster.translate函數代碼示例

本文整理匯總了TypeScript中react-jhipster.translate函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript translate函數的具體用法?TypeScript translate怎麽用?TypeScript translate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: translate

export const savePassword = (currentPassword, newPassword) => ({
  type: ACTION_TYPES.UPDATE_PASSWORD,
  payload: axios.post(`${apiUrl}/change-password`, { currentPassword, newPassword }),
  meta: {
    successMessage: translate('password.messages.success'),
    errorMessage: translate('password.messages.error')
  }
});
開發者ID:gjik911,項目名稱:git_01,代碼行數:8,代碼來源:password.reducer.ts

示例2: translate

export const handlePasswordResetInit = mail => ({
  type: ACTION_TYPES.RESET_PASSWORD_INIT,
  // If the content-type isn't set that way, axios will try to encode the body and thus modify the data sent to the server.
  payload: axios.post(`${apiUrl}/init`, mail, { headers: { ['Content-Type']: 'text/plain' } }),
  meta: {
    successMessage: translate('reset.request.messages.success'),
    errorMessage: translate('reset.request.messages.notfound')
  }
});
開發者ID:gjik911,項目名稱:git_01,代碼行數:9,代碼來源:password-reset.reducer.ts

示例3: translate

export const handleRegister = (login, email, password, langKey = 'en') => ({
  type: ACTION_TYPES.CREATE_ACCOUNT,
  payload: axios.post('api/register', { login, email, password, langKey }),
  meta: {
    successMessage: translate('register.messages.success')
  }
});
開發者ID:gjik911,項目名稱:git_01,代碼行數:7,代碼來源:register.reducer.ts

示例4: dispatch

export const saveAccountSettings = account => async dispatch => {
  await dispatch({
    type: ACTION_TYPES.UPDATE_ACCOUNT,
    payload: axios.post(apiUrl, account),
    meta: {
      successMessage: translate('settings.messages.success')
    }
  });
  dispatch(getSession());
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:10,代碼來源:settings.reducer.ts

示例5: async

export const saveAccountSettings = account => async (dispatch, getState) => {
  await dispatch({
    type: ACTION_TYPES.UPDATE_ACCOUNT,
    payload: axios.post(apiUrl, account),
    meta: {
      successMessage: translate('settings.messages.success')
    }
  });

  if (Storage.session.get(`locale`)) {
    Storage.session.remove(`locale`);
  }

  await dispatch(getSession());
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:15,代碼來源:settings.reducer.ts

示例6: async

export const saveAccountSettings = account => async (dispatch, getState) => {
  await dispatch({
    type: ACTION_TYPES.UPDATE_ACCOUNT,
    payload: axios.post(apiUrl, account),
    meta: {
      successMessage: translate('settings.messages.success')
    }
  });
  await dispatch(getSession());

  const accountState = getState().authentication.account;
  if (accountState && accountState.langKey) {
    await dispatch(setLocale(accountState.langKey));
  }
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:15,代碼來源:settings.reducer.ts

示例7: if

 .then(response => {
   if (action.meta && action.meta.successMessage) {
     toast.success(action.meta.successMessage);
   } else if (response && response.action && response.action.payload && response.action.payload.headers) {
     const headers = response.action.payload.headers;
     let alert: string = null;
     let alertParams: string = null;
     Object.entries(headers).forEach(([k, v]: [string, string]) => {
       if (k.endsWith('app-alert')) {
         alert = v;
       } else if (k.endsWith('app-params')) {
         alertParams = v;
       }
     });
     if (alert) {
       const alertParam = alertParams;
       toast.success(translate(alert, { param: alertParam }));
     }
   }
   return Promise.resolve(response);
 })
開發者ID:gjik911,項目名稱:git_01,代碼行數:21,代碼來源:notification-middleware.ts

示例8:

const addErrorAlert = (message, key?, data?) => {
  key = key ? key : message;
  toast.error(translate(key, data));
};
開發者ID:gjik911,項目名稱:git_01,代碼行數:4,代碼來源:notification-middleware.ts


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