本文整理汇总了TypeScript中src/services.setData函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setData函数的具体用法?TypeScript setData怎么用?TypeScript setData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setData函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setURL
export const updateOAuthClient = (clientId: number, data: Partial<OAuthClientRequest>) =>
Request<OAuthClient>(
setURL(`${API_ROOT}/account/oauth-clients/${clientId}`),
setMethod('PUT'),
setData(data, updateOAuthClientSchema),
)
.then(response => response.data);
示例2: setURL
export const makePayment = (data: { usd: string; cvv?: string }) => {
/**
* in the context of APIv4, CVV is optional - in other words, it's totally
* valid to submit a payment without a CVV
*
* BUT if CVV is included in the payload, APIv4 will send an error that CVV must
* have 3-4 characters.
*
* So for example this payload will result in an error
*
* {
* usd: 5,
* cvv: ''
* }
*
* but this is good
*
* {
* usd: 5
* }
*/
if (!data.cvv) {
delete data.cvv;
}
return Request<Linode.Payment>(
setURL(`${API_ROOT}/account/payments`),
setMethod('POST'),
setData(data, PaymentSchema)
).then(response => response.data);
};
示例3: setURL
export const updateUser = (username: string, data: Partial<User>) =>
Request<User>(
setURL(`${API_ROOT}/account/users/${username}`),
setMethod('PUT'),
setData(data, UpdateUserSchema),
)
.then(response => response.data);
示例4: setURL
export const makePayment = (data: { usd: string, cvv?: string }) =>
Request<Linode.Payment>(
setURL(`${API_ROOT}/account/payments`),
setMethod('POST'),
setData(data, PaymentSchema),
)
.then(response => response.data)
示例5: setURL
export const updateAccountSettings = (data: Partial<Linode.AccountSettings>) =>
Request<Linode.AccountSettings>(
setURL(`${API_ROOT}/account/settings`),
setMethod('PUT'),
setData(data, UpdateAccountSettingsSchema)
)
.then(response => response.data);