mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-03 06:17:35 +01:00
28 lines
602 B
JavaScript
28 lines
602 B
JavaScript
import rxjs from "../lib/rx.js";
|
|
import ajax from "../lib/ajax.js";
|
|
|
|
export function createSession(authenticationRequest) {
|
|
return ajax({
|
|
method: "POST",
|
|
url: "/api/session",
|
|
body: authenticationRequest,
|
|
responseType: "json",
|
|
});
|
|
}
|
|
|
|
export function getSession() {
|
|
return ajax({
|
|
url: "/api/session",
|
|
method: "GET",
|
|
responseType: "json"
|
|
}).pipe(
|
|
rxjs.map(({ responseJSON }) => responseJSON.result)
|
|
);
|
|
}
|
|
|
|
export function deleteSession() {
|
|
return ajax({
|
|
url: "/api/session",
|
|
method: "DELETE"
|
|
});
|
|
}
|