mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-28 16:17:02 +00:00
Optimize excalidraw code (#7942)
* optimize code * optimize code * optimize code * optimize code --------- Co-authored-by: 小强 <shuntian@Mac.lan>
This commit is contained in:
28
frontend/src/pages/excalidraw-editor/api/index.js
Normal file
28
frontend/src/pages/excalidraw-editor/api/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import axios from 'axios';
|
||||
|
||||
class ExcalidrawServerApi {
|
||||
|
||||
constructor(options) {
|
||||
this.server = options.exdrawServer;
|
||||
this.docUuid = options.exdrawUuid;
|
||||
this.accessToken = options.accessToken;
|
||||
}
|
||||
|
||||
getSceneContent() {
|
||||
const { server, docUuid, accessToken } = this;
|
||||
const url = `${server}/api/v1/exdraw/${docUuid}/`;
|
||||
|
||||
return axios.get(url, { headers: { Authorization: `Token ${accessToken}` } });
|
||||
}
|
||||
|
||||
saveSceneContent(content) {
|
||||
const { server, docUuid, accessToken } = this;
|
||||
const url = `${server}/api/v1/exdraw/${docUuid}/`;
|
||||
const formData = new FormData();
|
||||
formData.append('doc_content', content);
|
||||
|
||||
return axios.post(url, formData, { headers: { Authorization: `Token ${accessToken}` } });
|
||||
}
|
||||
}
|
||||
|
||||
export default ExcalidrawServerApi;
|
Reference in New Issue
Block a user