fix download attachment

This commit is contained in:
Peter Maquiran
2024-09-13 12:59:56 +01:00
parent 5c157d4c63
commit 4b6364fac1
4 changed files with 16 additions and 20 deletions
@@ -14,7 +14,7 @@ export class AttachmentRemoteDataSourceService implements IAttachmentRemoteRepos
) { }
async getAttachment(id: string | number): DataSourceReturn<Blob> {
return await this.httpService.get(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' });
return await this.httpService.getFile(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' });
}
}
@@ -50,19 +50,6 @@ export class SyncAllRoomMessagesService {
delete message.sentAt
let clone: MessageTable = { ...message, roomId: room.id };
this.messageLocalDataSourceService.update(clone.$id, clone);
// const me = message.info.find(e => e.memberId === SessionStore.user.UserId && typeof e.deliverAt === 'string');
// if (!me) {
// this.MessageSocketRepositoryService.sendDeliverAt({
// memberId: SessionStore.user.UserId,
// messageId: message.id,
// roomId: message.roomId,
// requestId: uuidv4()
// });
// tracing.addEvent('send deliver roomId ' + room.id);
// }
}
for (const message of addedItems) {
+9
View File
@@ -78,6 +78,15 @@ export class HttpService {
}
}
async getFile<T>(url: string, options ={}): Promise<Result<T, HttpErrorResponse>> {
try {
const result = await this.http.get<T>(url, options).toPromise()
return ok (result as T)
} catch (e) {
return err(e as HttpErrorResponse)
}
}
async put<T>(url: string, body: any): Promise<Result<T, HttpErrorResponse>> {
try {
File diff suppressed because one or more lines are too long