本文整理汇总了TypeScript中antd.message.error方法的典型用法代码示例。如果您正苦于以下问题:TypeScript message.error方法的具体用法?TypeScript message.error怎么用?TypeScript message.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类antd.message
的用法示例。
在下文中一共展示了message.error方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
response.json().then(json => {
try {
message.error("错误," + json['error'])
}catch(e){
message.error("发生错误")
}
})
示例2: 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
}
示例3: 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;
}
示例4: 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));
}
}
}
示例5: 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("用户名或密码字段不能为空")
}
}
示例6: 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));
}
}
}
示例7:
(result: AxiosResponse<IResult<any, any>>) => {
if (result.data.errno !== 0) {
if (typeof result.data.errmsg === 'string') {
message.error(result.data.errmsg);
}
}
return Promise.resolve(result);
},
示例8:
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);
}
},
示例9: dispatch
).then(response=> {
if (response.status === 404) {
dispatch(UpdateClassPlan(null));
} else if (response.status === 200) {
response.json().then(json=>dispatch(UpdateClassPlan(json)))
} else {
message.error('发生错误,错误码为' + response.status)
}
})
示例10: catchError
catchError((error: AxiosResponse | undefined) => {
console.log(error);
if (error === undefined) {
return message.error('请求出错');
}
this.error$ = of(error);
this.handleError();
return this.error$;
})