本文整理汇总了TypeScript中rxjs/ajax.ajax函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ajax函数的具体用法?TypeScript ajax怎么用?TypeScript ajax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ajax函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ajax
export const listCheckpoints = (serverConfig: ServerConfig, path: string) =>
ajax(
createAJAXSettings(serverConfig, formCheckpointURI(path, ""), {
cache: false,
method: "GET"
})
);
示例2: publishGist
function publishGist(
model: { files: GithubFiles; description: string; public: boolean },
token: string,
id: string | null
) {
const url =
id !== null
? `https://api.github.com/gists/${id}`
: "https://api.github.com/gists";
const opts = {
url,
responseType: "json",
// This allows for us to provide a serverside XMLHttpRequest
createXHR() {
return new XMLHttpRequest();
},
headers: {
"Content-Type": "application/json",
// We can only update authenticated gists so we _must_ send the token
Authorization: `token ${token}`
},
method: id !== null ? "PATCH" : "POST",
body: model
};
return ajax(opts);
}
示例3: ajax
export const get = (
serverConfig: ServerConfig,
sessionID: string
): Observable<AjaxResponse> =>
ajax(
createAJAXSettings(serverConfig, `/api/sessions/${sessionID}`, {
cache: false
})
);
示例4: ajax
export const get = (
serverConfig: ServerConfig,
name: string
): Observable<AjaxResponse> =>
ajax(
createAJAXSettings(serverConfig, `/api/kernelspecs/${name}`, {
cache: false
})
);
示例5: ajax
export const destroy = (
serverConfig: ServerConfig,
id: string
): Observable<AjaxResponse> =>
ajax(
createAJAXSettings(serverConfig, formURI(id), {
method: "DELETE"
})
);
示例6: ajax
export const restoreFromCheckpoint = (
serverConfig: ServerConfig,
path: string,
checkpointID: string
) =>
ajax(
createAJAXSettings(serverConfig, formCheckpointURI(path, checkpointID), {
method: "POST"
})
);
示例7: ajax
export const create = (serverConfig: ServerConfig, body: object): Observable<AjaxResponse> =>
ajax(
createAJAXSettings(serverConfig, "/api/sessions", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body
})
);
示例8: ajax
export const start = (serverConfig: ServerConfig, name: string, path: string) =>
ajax(
createAJAXSettings(serverConfig, "/api/kernels", {
headers: {
"Content-Type": "application/json"
},
method: "POST",
body: { path, name }
})
);