本文整理匯總了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;
}