本文整理汇总了TypeScript中axios.patch函数的典型用法代码示例。如果您正苦于以下问题:TypeScript patch函数的具体用法?TypeScript patch怎么用?TypeScript patch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了patch函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fromPromise
patch<T = any>(
url: string,
data?,
config?: AxiosRequestConfig,
): Observable<AxiosResponse<T>> {
return fromPromise(axios.patch(url, data, config));
}
示例2: dispatch
export const applyGarden = (gardenId: number) => (dispatch: Function) => axios
.patch<void>(API.current.applyGardenPath(gardenId))
.then(() => {
history.push("/app/designer/plants");
dispatch(unselectSavedGarden);
const busyToastTitle = t("Please wait");
info(t("while your garden is applied."), busyToastTitle, "blue");
});
示例3: patchItems
/**
* Update multiple entities but only the changed fields
*/
async patchItems(entityTypeName: string, patchPairs: IPatchPair[]): Promise<any> {
var entitySetName = this.metadataCli.entityTypes[entityTypeName].entitySetName;
var url = this.apiUrl + "/crud/" + "batch/" + entitySetName;
var response = await axios.patch(url, patchPairs.map((it) => it.patchItem));
return response.data;
}
示例4: return
return (dispatch, getState) => {
axios.patch<User>(API.current.usersPath, user)
.then((resp) => {
success(t("User successfully updated."));
dispatch(updateUserSuccess(resp.data));
}, (e: Error) => {
error(t(`User could not be updated: ${e.message}`));
});
};
示例5: mergeMap
mergeMap((action: any) => {
return axios
.patch(makeApiUrl(`/task-card/${action.payload.id}`), {
id: action.payload.id,
status: 'ARCHIVE'
})
.then(() => Actions.ARCHIVE_TASK_CARD.success({ id: action.payload.id }))
.catch(resp => Actions.ARCHIVE_TASK_CARD.failure(resp.data));
})
示例6: it
it('PATCH .patch', () => {
const original = {
description: 'PATCH .patch'
};
return axios.patch(`http://localhost:${port}/${name}/544`, original)
.then(res => {
assert.ok(res.status === 200, 'Got OK status code');
verify.patch('544', original, res.data);
});
});
示例7: Promise
return new Promise((resolve, reject) => {
axios.patch(
'/api/Calendars/' + id + '?authorization=' + authorization,
{occurrences: occurrences}
)
.then((response) => {
resolve(ensueCalendarHasOccurrences(response.data));
})
.catch(function (error) {
reject(error);
});
});
示例8: patchItem
/**
* Update single entity but only the changed fields
*/
async patchItem(entityTypeName: string, item: IPatchPair): Promise<any> {
var entitySetName = this.metadataCli.entityTypes[entityTypeName].entitySetName,
keyNames = this.metadataCli.entityTypes[entityTypeName].key;
var queryObject: IQueryObject = {
keys: [utils.getKeyFromData(keyNames, item.partialDto)]
};
var query = queryUtils.renderQueryString(queryObject);
var url = this.apiUrl + "/crud/" + entitySetName + (query ? "?" + query : ""); //utils.getUrlKeyFromData(keyNames, item.partialDto);
var response = await axios.patch(url, item.patchItem);
return response.data;
}