🌟 Fix download button (#210)

* Add auth cookie to avoid using auth token in the url
* Fix all download button 
* Refactor some of the places where we download file
This commit is contained in:
Anton Shepilov
2023-09-21 14:08:57 +02:00
committed by GitHub
parent 43a5dbddf1
commit d88feaaba8
14 changed files with 61 additions and 125 deletions
@@ -111,22 +111,10 @@ export class DriveApiClient {
);
}
static async getDownloadToken(companyId: string, ids: string[], versionId?: string) {
return Api.get<{ token: string }>(
`/internal/services/documents/v1/companies/${companyId}/item/download/token` +
`?items=${ids.join(',')}&version_id=${versionId}` +
appendTdriveToken(true),
);
}
static async getDownloadUrl(companyId: string, id: string, versionId?: string) {
static getDownloadUrl(companyId: string, id: string, versionId?: string) {
if (versionId)
return Api.route(
`/internal/services/files/v1/companies/${companyId}/files/${id}/download?version_id=${versionId}`,
);
return Api.route(
`/internal/services/files/v1/companies/${companyId}/files/${id}/download`,
);
return Api.route(`/internal/services/documents/v1/companies/${companyId}/item/${id}/download?version_id=${versionId}`);
return Api.route(`/internal/services/documents/v1/companies/${companyId}/item/${id}/download`);
}
static async getDownloadZipUrl(companyId: string, ids: string[]) {