mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 15:55:31 +01:00
add ability to manually clear the cache on matching models
This commit is contained in:
parent
bd02c78966
commit
544ca8d008
1 changed files with 8 additions and 4 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue