mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 19:00:12 +00:00
@@ -1,12 +1,18 @@
|
||||
import axios from 'axios';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
|
||||
const { rawPath } = window.shared.pageOptions;
|
||||
const { rawPath, docUuid, exdrawAccessToken, exdrawServerUrl } = window.shared.pageOptions;
|
||||
|
||||
class EditorApi {
|
||||
|
||||
getFileContent = () => {
|
||||
return seafileAPI.getFileContent(rawPath);
|
||||
};
|
||||
|
||||
getExdrawContent = () => {
|
||||
const url = `${exdrawServerUrl}/api/v1/exdraw/${docUuid}/`;
|
||||
return axios.get(url, { headers: { Authorization: `Token ${exdrawAccessToken}` } });
|
||||
};
|
||||
}
|
||||
|
||||
const editorApi = new EditorApi();
|
||||
|
@@ -12,7 +12,7 @@ const ExcaliViewer = () => {
|
||||
const [isResize, setIsResize] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
editorApi.getFileContent().then(res => {
|
||||
editorApi.getExdrawContent().then(res => {
|
||||
if (res.data?.appState?.collaborators && !Array.isArray(res.data.appState.collaborators)) {
|
||||
// collaborators.forEach is not a function
|
||||
res.data['appState']['collaborators'] = [];
|
||||
|
Reference in New Issue
Block a user