本文整理汇总了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;未经允许,请勿转载。 |
请发表评论