本文整理汇总了TypeScript中axios.put函数的典型用法代码示例。如果您正苦于以下问题:TypeScript put函数的具体用法?TypeScript put怎么用?TypeScript put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('Should stub and find multiple requests by method', (done) => {
moxios.stubOnce('PUT', '/users/12345', {
status: 204
});
moxios.stubOnce('GET', '/users/12346', {
status: 200,
response: USER_FRED
});
axios.put('/users/12345', USER_FRED).then(onFulfilled);
axios.get('/users/12346', {}).then(onFulfilled);
moxios.wait(() => {
equal(onFulfilled.calledTwice, true);
let response1 = onFulfilled.getCall(0).args[0];
let response2 = onFulfilled.getCall(1).args[0];
equal(response1.status, 204);
equal(response2.status, 200);
equal(response2.data.firstName, 'Fred');
let request = moxios.requests.get('PUT', '/users/12345');
notEqual(request, undefined);
request = moxios.requests.get('GET', '/users/12346');
notEqual(request, undefined);
done();
});
});
示例2: dispatch
return async dispatch => {
await dispatch({
type: ACTION_TYPES.FETCH_LOGS_CHANGE_LEVEL,
payload: axios.put('/management/jhipster/logs', body)
});
dispatch(getLoggers());
};
示例3: fromPromise
put<T = any>(
url: string,
data?,
config?: AxiosRequestConfig,
): Observable<AxiosResponse<T>> {
return fromPromise(axios.put(url, data, config));
}
示例4: dispatch
export const updateEntity: ICrudPutAction<IDialogue> = entity => async dispatch => {
const result = await dispatch({
type: ACTION_TYPES.UPDATE_DIALOGUE,
payload: axios.put(apiUrl, cleanEntity(entity))
});
dispatch(getEntities());
return result;
};
示例5: dispatch
export const updateEntity: ICrudPutAction<IFlockRelation> = entity => async dispatch => {
const result = await dispatch({
type: ACTION_TYPES.UPDATE_FLOCKRELATION,
payload: axios.put(apiUrl, cleanEntity(entity))
});
dispatch(getEntities());
return result;
};
示例6: dispatch
export const updateEntity: ICrudPutAction<ICurrentMessage> = entity => async dispatch => {
const result = await dispatch({
type: ACTION_TYPES.UPDATE_CURRENTMESSAGE,
payload: axios.put(apiUrl, cleanEntity(entity))
});
dispatch(getEntities());
return result;
};
示例7: dispatch
export const updateUser: ICrudPutAction<IUser> = user => async dispatch => {
const result = await dispatch({
type: ACTION_TYPES.UPDATE_USER,
payload: axios.put(apiUrl, user)
});
dispatch(getUsers());
return result;
};
示例8: dispatch
export const updateEntity: ICrudPutAction<ICustomerFlock> = entity => async dispatch => {
const result = await dispatch({
type: ACTION_TYPES.UPDATE_CUSTOMERFLOCK,
payload: axios.put(apiUrl, cleanEntity(entity))
});
dispatch(getEntities());
return result;
};
示例9: update
update(entity: T): Promise<T> {
const entityId = entity.id;
entity = this.mapper.removeId(entity);
return axios
.put(`${this.endPointUrl}/${this.collectionName}/${entityId}.json`, entity)
.then(response => response.data);
}
示例10: Promise
return new Promise((resolve, reject) => {
Axios.put(url, request, options)
.then(response => {
resolve(response.data)
})
.catch(e => {
reject(e)
})
})