mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	add ability to manually clear the cache on matching models
This commit is contained in:
		| @@ -74,27 +74,31 @@ export abstract class AbstractPaperlessService<T extends ObjectWithId> { | |||||||
|     ) |     ) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   clearCache() { | ||||||
|  |     this._listAll = null | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get(id: number): Observable<T> { |   get(id: number): Observable<T> { | ||||||
|     return this.http.get<T>(this.getResourceUrl(id)) |     return this.http.get<T>(this.getResourceUrl(id)) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   create(o: T): Observable<T> { |   create(o: T): Observable<T> { | ||||||
|     this._listAll = null |     this.clearCache() | ||||||
|     return this.http.post<T>(this.getResourceUrl(), o) |     return this.http.post<T>(this.getResourceUrl(), o) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   delete(o: T): Observable<any> { |   delete(o: T): Observable<any> { | ||||||
|     this._listAll = null |     this.clearCache() | ||||||
|     return this.http.delete(this.getResourceUrl(o.id)) |     return this.http.delete(this.getResourceUrl(o.id)) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   update(o: T): Observable<T> { |   update(o: T): Observable<T> { | ||||||
|     this._listAll = null |     this.clearCache() | ||||||
|     return this.http.put<T>(this.getResourceUrl(o.id), o) |     return this.http.put<T>(this.getResourceUrl(o.id), o) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   patch(o: T): Observable<T> { |   patch(o: T): Observable<T> { | ||||||
|     this._listAll = null |     this.clearCache() | ||||||
|     return this.http.patch<T>(this.getResourceUrl(o.id), o) |     return this.http.patch<T>(this.getResourceUrl(o.id), o) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler