diff --git a/resources/scripts/api/server/files/saveFileContents.ts b/resources/scripts/api/server/files/saveFileContents.ts new file mode 100644 index 000000000..22f1766c3 --- /dev/null +++ b/resources/scripts/api/server/files/saveFileContents.ts @@ -0,0 +1,18 @@ +import http from '@/api/http'; + +export default (uuid: string, file: string, content: string): Promise => { + return new Promise((resolve, reject) => { + http.post( + `/api/client/servers/${uuid}/files/write`, + content, + { + params: { file }, + headers: { + 'Content-Type': 'text/plain', + }, + }, + ) + .then(() => resolve()) + .catch(reject); + }); +}; diff --git a/resources/scripts/components/elements/AceEditor.tsx b/resources/scripts/components/elements/AceEditor.tsx index 3afab6364..e62c24d95 100644 --- a/resources/scripts/components/elements/AceEditor.tsx +++ b/resources/scripts/components/elements/AceEditor.tsx @@ -113,7 +113,7 @@ export default ({ style, initialContent, initialModePath, fetchContent, onConten return (
-
+