refactor: re-use editor component and other minor changes

This commit is contained in:
2022-07-15 11:06:41 +05:30
parent f5d3a26ae1
commit c5bfc3dd35
7 changed files with 111 additions and 45 deletions

16
src/api/bin.ts Normal file
View File

@ -0,0 +1,16 @@
export const setPaste = async (code: string): Promise<Response> => {
return await fetch("http://localhost:8080/bin/paste", {
method: "POST",
headers: { "Content-type": "text/plain" },
body: code,
});
};
export const getPaste = async (pasteId: string) => {
return await fetch(`http://localhost:8080/bin/paste/${pasteId}`);
};
export interface SuccessResponse {
message: string;
endpoint: string;
}