no-store cache

This commit is contained in:
Kyle Spearrin 2020-01-13 07:49:05 -05:00
parent 3f17b642b4
commit 5819023bc4
4 changed files with 9 additions and 9 deletions

View File

@ -115,7 +115,7 @@ export class AttachmentsComponent implements OnInit {
} }
a.downloading = true; 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) { if (response.status !== 200) {
this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred'));
a.downloading = false; a.downloading = false;
@ -170,7 +170,7 @@ export class AttachmentsComponent implements OnInit {
this.reuploadPromises[attachment.id] = Promise.resolve().then(async () => { this.reuploadPromises[attachment.id] = Promise.resolve().then(async () => {
// 1. Download // 1. Download
a.downloading = true; 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) { if (response.status !== 200) {
this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred'));
a.downloading = false; a.downloading = false;

View File

@ -192,7 +192,7 @@ export class ViewComponent implements OnDestroy, OnInit {
} }
a.downloading = true; 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) { if (response.status !== 200) {
this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred')); this.platformUtilsService.showToast('error', null, this.i18nService.t('errorOccurred'));
a.downloading = false; a.downloading = false;

View File

@ -169,7 +169,7 @@ export class ApiService implements ApiServiceAbstraction {
const response = await this.fetch(new Request(this.identityBaseUrl + '/connect/token', { const response = await this.fetch(new Request(this.identityBaseUrl + '/connect/token', {
body: this.qsStringify(request.toIdentityToken(this.platformUtilsService.identityClientId)), body: this.qsStringify(request.toIdentityToken(this.platformUtilsService.identityClientId)),
credentials: this.getCredentials(), credentials: this.getCredentials(),
cache: 'no-cache', cache: 'no-store',
headers: headers, headers: headers,
method: 'POST', method: 'POST',
})); }));
@ -868,7 +868,7 @@ export class ApiService implements ApiServiceAbstraction {
headers.set('User-Agent', this.customUserAgent); headers.set('User-Agent', this.customUserAgent);
} }
const response = await this.fetch(new Request(this.eventsBaseUrl + '/collect', { const response = await this.fetch(new Request(this.eventsBaseUrl + '/collect', {
cache: 'no-cache', cache: 'no-store',
credentials: this.getCredentials(), credentials: this.getCredentials(),
method: 'POST', method: 'POST',
body: JSON.stringify(request), body: JSON.stringify(request),
@ -918,7 +918,7 @@ export class ApiService implements ApiServiceAbstraction {
fetch(request: Request): Promise<Response> { fetch(request: Request): Promise<Response> {
if (request.method === 'GET') { if (request.method === 'GET') {
request.headers.set('Cache-Control', 'no-cache'); request.headers.set('Cache-Control', 'no-store');
request.headers.set('Pragma', 'no-cache'); request.headers.set('Pragma', 'no-cache');
} }
return this.nativeFetch(request); return this.nativeFetch(request);
@ -938,7 +938,7 @@ export class ApiService implements ApiServiceAbstraction {
} }
const requestInit: RequestInit = { const requestInit: RequestInit = {
cache: 'no-cache', cache: 'no-store',
credentials: this.getCredentials(), credentials: this.getCredentials(),
method: method, method: method,
}; };
@ -1011,7 +1011,7 @@ export class ApiService implements ApiServiceAbstraction {
client_id: decodedToken.client_id, client_id: decodedToken.client_id,
refresh_token: refreshToken, refresh_token: refreshToken,
}), }),
cache: 'no-cache', cache: 'no-store',
credentials: this.getCredentials(), credentials: this.getCredentials(),
headers: headers, headers: headers,
method: 'POST', method: 'POST',

View File

@ -795,7 +795,7 @@ export class CipherService implements CipherServiceAbstraction {
private async shareAttachmentWithServer(attachmentView: AttachmentView, cipherId: string, private async shareAttachmentWithServer(attachmentView: AttachmentView, cipherId: string,
organizationId: string): Promise<any> { organizationId: string): Promise<any> {
const attachmentResponse = await this.apiService.nativeFetch( const attachmentResponse = await this.apiService.nativeFetch(
new Request(attachmentView.url, { cache: 'no-cache' })); new Request(attachmentView.url, { cache: 'no-store' }));
if (attachmentResponse.status !== 200) { if (attachmentResponse.status !== 200) {
throw Error('Failed to download attachment: ' + attachmentResponse.status.toString()); throw Error('Failed to download attachment: ' + attachmentResponse.status.toString());
} }