🩹 ooconnector: using user token for post to backend (#525)
This commit is contained in:
@@ -91,7 +91,7 @@ class ApiService implements IApiService {
|
||||
};
|
||||
|
||||
public post = async <T, R>(params: IApiServiceRequestParams<T>): Promise<R> => {
|
||||
const { url, payload, headers } = params;
|
||||
const { url, token, payload, headers } = params;
|
||||
|
||||
const axiosWithToken = await this.requireAxios();
|
||||
|
||||
@@ -99,6 +99,7 @@ class ApiService implements IApiService {
|
||||
return await axiosWithToken.post(url, payload, {
|
||||
headers: {
|
||||
...headers,
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -49,12 +49,12 @@ class DriveService implements IDriveService {
|
||||
}
|
||||
};
|
||||
|
||||
public async beginEditingSession(company_id: string, drive_file_id: string) {
|
||||
public async beginEditingSession(company_id: string, drive_file_id: string, user_token?: string) {
|
||||
try {
|
||||
const resource = await apiService.post<{}, { editingSessionKey: string }>({
|
||||
url: `/internal/services/documents/v1/companies/${company_id}/item/${drive_file_id}/editing_session`,
|
||||
payload: {
|
||||
editorApplicationId: 'mock_application_id',
|
||||
editorApplicationId: 'tdrive_onlyoffice',
|
||||
},
|
||||
});
|
||||
if (resource?.editingSessionKey) {
|
||||
|
||||
Reference in New Issue
Block a user