本文整理汇总了TypeScript中antd.message类的典型用法代码示例。如果您正苦于以下问题:TypeScript message类的具体用法?TypeScript message怎么用?TypeScript message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了message类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: loadModels
function* loadModels({ payload: { name, models } }: LoadModelsParams) {
const { token } = yield select((state: RootState) => state.auth);
if (token) {
try {
const {
[name]: { extras },
} = models;
logger.debug('[loadModels]', 'loading content', { name, extras });
message.loading(`loading content '${name}'...`);
const response = yield call(AppContext.adapters.models.loadModels, name, extras);
message.success(`load content '${name}' success`);
logger.log('[loadModels]', 'loaded content', { name, response });
yield put(
contentActions.loadModelsSuccess({
[name]: { data: response.data, loading: false },
}),
);
} catch (e) {
logger.warn('[loadModels]', { e });
message.error(toErrorMessage(e));
}
}
}
开发者ID:danielwii,项目名称:asuna-admin,代码行数:25,代码来源:content.redux.ts
示例2: loginSaga
function* loginSaga({ payload: { username, password }, callback }) {
const auth: AuthState = yield select((state: RootState) => state.auth);
try {
const response = yield call(authProxy.login, username, password);
logger.log('[loginSaga]', 'response is', response);
// 切换用户时更新操作区域,如果未来需要保存当前页面配置的话,应该将切换操作提出为单独的 Saga
if (auth.username !== username) {
yield put(panesActions.closeAll());
}
if (callback) callback({ response });
const token = yield call(authProxy.extractToken, response.data);
yield put(authActions.loginSuccess(username, token));
message.info(`'${username}' login success`);
yield put(routerActions.toIndex());
} catch (error) {
logger.error('[loginSaga]', { error });
try {
if (callback != null) callback({ error });
} catch (e) {
logger.warn('[upsert] callback error', e, { e });
}
if (error.response) {
yield put(authActions.loginFailed(error.response));
message.error(toErrorMessage(error));
}
}
}
开发者ID:danielwii,项目名称:asuna-admin,代码行数:30,代码来源:auth.redux.ts
示例3: state
(dispatch: Redux.Dispatch, state: ()=>any)=> {
let _state: QueryInterface = state().query_list;
if (_state.start && !_state.end) {
message.error("当指定开始时间时,必须同时指定结束时间");
return
}
if (_state.end && !_state.start) {
message.error("当指定结束时间时,必须同时指定开始时间");
return
}
if (_state.end < _state.start) {
message.error("结束时间不能小于开始时间");
return
}
const url = `/api/query/query-call-over/?${parse_data(_state.start, 'start')}${parse_data(_state.end, 'end')}department=${_state.current_department}`;
fetch(url, {
credentials: 'include',
method: 'get',
}).then(response=> {
if (response.status == 200) {
response.json().then((json)=> {
dispatch(UpdateListData(json))
})
} else {
response.json().then(json=>message.error(JSON.stringify(json)))
}
});
return
}
开发者ID:rui19921122,项目名称:MeetingSystem,代码行数:29,代码来源:query.ts
示例4:
response.json().then(json => {
try {
message.error("错误," + json['error'])
}catch(e){
message.error("发生错误")
}
})
开发者ID:rui19921122,项目名称:MeetingSystem,代码行数:7,代码来源:manage-check.ts
示例5: Promise
return new Promise((resolve, reject) => {
if (/^20\d$/.test(response.status as any)) {
message.success('upload successfully.');
resolve(response.data);
} else {
message.error('upload failed.');
reject(response);
}
});
开发者ID:danielwii,项目名称:asuna-admin,代码行数:9,代码来源:upload.ts
示例6: getState
}).then(response => {
if (response.status != 202) {
message.error("替换失败")
} else {
let state = getState();
dispatch(GetData((state.manage_check as manage_check_store).selectDate, (state.manage_check as manage_check_store).selectClassName));
message.success("替换成功");
dispatch(showModal(false))
}
}
开发者ID:rui19921122,项目名称:MeetingSystem,代码行数:10,代码来源:manage-check.ts
示例7: validateFile
export function validateFile(file: { type: string; size: number }): boolean {
// console.log(file);
const isImage = ['image/jpeg', 'image/png', 'image/gif'].indexOf(file.type) > -1;
const isLt20M = file.size / 1024 / 1024 < 20;
logger.log('[validateFile]', file, { isImage, isLt20M });
if (!isImage) {
message.error('You can only upload JPG/PNG/GIF file!');
}
if (!isLt20M) {
message.error('Image must smaller than 20MB!');
}
return isImage && isLt20M;
}
开发者ID:danielwii,项目名称:asuna-admin,代码行数:13,代码来源:upload.ts
示例8: fetch
(dispatch:Redux.Dispatch, getState:()=>any)=> {
if(username.length>0 && password.length>0){
fetch('/api/scrapy/about-password/', {
credentials: 'include',
method: 'post',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ password: password, username: username })
}).then(response => {
if (response.status == 200) {
message.success("成功更改了密码")
dispatch(actions.change_password_modal(false))
} else {
response.json().then(json => {
try {
message.error("错误," + json['error'])
}catch(e){
message.error("发生错误")
}
})
}
})
}else{
message.error("用户名或密码字段不能为空")
}
}
开发者ID:rui19921122,项目名称:MeetingSystem,代码行数:25,代码来源:manage-check.ts
示例9:
.then((resp: any) => {
message.success('Add todo success');
if (action.meta && action.meta.closeFn) {
action.meta.closeFn();
}
return Actions.ADD_TODO.success(resp);
})
开发者ID:A-Horse,项目名称:bblist,代码行数:7,代码来源:todo.epic.ts
示例10:
UPDATE_DATE_RANGE: (state,
action: ActionMeta<{ end: moment.Moment, start: moment.Moment}, {}>) => {
if (action.error) {
message.error(`Error updating date range.`);
} else {
return Object.assign({}, state, action.payload);
}
},
开发者ID:OpenChatAlytics,项目名称:OpenChatAlyticsUI,代码行数:8,代码来源:index.ts
注:本文中的antd.message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论