From 5819023bc4986cdcff3004e3c75ee5ab8c9a1dfc Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 13 Jan 2020 07:49:05 -0500 Subject: [PATCH] no-store cache --- src/angular/components/attachments.component.ts | 4 ++-- src/angular/components/view.component.ts | 2 +- src/services/api.service.ts | 10 +++++----- src/services/cipher.service.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/angular/components/attachments.component.ts b/src/angular/components/attachments.component.ts index 58704900ac..b3f8e7d0c8 100644 --- a/src/angular/components/attachments.component.ts +++ b/src/angular/components/attachments.component.ts @@ -115,7 +115,7 @@ export class AttachmentsComponent implements OnInit { } a.downloading = true; - const response = await fetch(new Request(attachment.url, { cache: 'no-cache' })); + const response = await fetch(new Request(attachment.url, { cache: 'no-store' })); if (response.status !== 200) { this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); a.downloading = false; @@ -170,7 +170,7 @@ export class AttachmentsComponent implements OnInit { this.reuploadPromises[attachment.id] = Promise.resolve().then(async () => { // 1. Download a.downloading = true; - const response = await fetch(new Request(attachment.url, { cache: 'no-cache' })); + const response = await fetch(new Request(attachment.url, { cache: 'no-store' })); if (response.status !== 200) { this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); a.downloading = false; diff --git a/src/angular/components/view.component.ts b/src/angular/components/view.component.ts index 365055f87f..431c4d3786 100644 --- a/src/angular/components/view.component.ts +++ b/src/angular/components/view.component.ts @@ -192,7 +192,7 @@ export class ViewComponent implements OnDestroy, OnInit { } a.downloading = true; - const response = await fetch(new Request(attachment.url, { cache: 'no-cache' })); + const response = await fetch(new Request(attachment.url, { cache: 'no-store' })); if (response.status !== 200) { this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); a.downloading = false; diff --git a/src/services/api.service.ts b/src/services/api.service.ts index d62f2a2abc..a1a0ca3c55 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -169,7 +169,7 @@ export class ApiService implements ApiServiceAbstraction { const response = await this.fetch(new Request(this.identityBaseUrl + '/connect/token', { body: this.qsStringify(request.toIdentityToken(this.platformUtilsService.identityClientId)), credentials: this.getCredentials(), - cache: 'no-cache', + cache: 'no-store', headers: headers, method: 'POST', })); @@ -868,7 +868,7 @@ export class ApiService implements ApiServiceAbstraction { headers.set('User-Agent', this.customUserAgent); } const response = await this.fetch(new Request(this.eventsBaseUrl + '/collect', { - cache: 'no-cache', + cache: 'no-store', credentials: this.getCredentials(), method: 'POST', body: JSON.stringify(request), @@ -918,7 +918,7 @@ export class ApiService implements ApiServiceAbstraction { fetch(request: Request): Promise { if (request.method === 'GET') { - request.headers.set('Cache-Control', 'no-cache'); + request.headers.set('Cache-Control', 'no-store'); request.headers.set('Pragma', 'no-cache'); } return this.nativeFetch(request); @@ -938,7 +938,7 @@ export class ApiService implements ApiServiceAbstraction { } const requestInit: RequestInit = { - cache: 'no-cache', + cache: 'no-store', credentials: this.getCredentials(), method: method, }; @@ -1011,7 +1011,7 @@ export class ApiService implements ApiServiceAbstraction { client_id: decodedToken.client_id, refresh_token: refreshToken, }), - cache: 'no-cache', + cache: 'no-store', credentials: this.getCredentials(), headers: headers, method: 'POST', diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index c602c409ec..6e7296e09c 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -795,7 +795,7 @@ export class CipherService implements CipherServiceAbstraction { private async shareAttachmentWithServer(attachmentView: AttachmentView, cipherId: string, organizationId: string): Promise { const attachmentResponse = await this.apiService.nativeFetch( - new Request(attachmentView.url, { cache: 'no-cache' })); + new Request(attachmentView.url, { cache: 'no-store' })); if (attachmentResponse.status !== 200) { throw Error('Failed to download attachment: ' + attachmentResponse.status.toString()); }