mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-21 07:42:30 +01:00
22 lines
809 B
JavaScript
22 lines
809 B
JavaScript
import rxjs from "../../lib/rx.js";
|
|
import ajax from "../../lib/ajax.js";
|
|
import { getCurrentPath } from "./common.js";
|
|
import { forwardURLParams } from "../../lib/path.js";
|
|
|
|
export const options = () => ajax({
|
|
url: forwardURLParams(`api/files/cat?path=${encodeURIComponent(getCurrentPath())}`, ["share"]),
|
|
method: "OPTIONS",
|
|
}).pipe(rxjs.map((res) => res.responseHeaders.allow.replace(/\r/, "").split(", ")));
|
|
|
|
export const cat = () => ajax({
|
|
url: forwardURLParams("api/files/cat?path=" + encodeURIComponent(getCurrentPath()), ["share"]),
|
|
method: "GET",
|
|
}).pipe(
|
|
rxjs.map(({ response }) => response),
|
|
);
|
|
|
|
export const save = (content) => ajax({
|
|
url: forwardURLParams("api/files/cat?path=" + encodeURIComponent(getCurrentPath()), ["share"]),
|
|
method: "POST",
|
|
body: content,
|
|
});
|