I am new to rxjs and am trying to figure out how to have Observables keep data on switching and/or reloading pages.
I can stay on the same page and the caching service works. But when I go to another page in the web application (this is not a single page web app) the data is refreshed and the cache service is empty. Is there a way besides using localStorage or cookies to store the data?
getToken(id: number): Observable<TempTokens> {
if (!this._token) {
const url = `${this.tokenUrl}/${id}`;
this._token = this.http.get<TempTokens>(url).pipe(
map((res: TempTokens) => res),
publishReplay(1),
refCount(),
);
}
return this._token;
}
My goal is to not store the data in the browser so I can prevent users from modifying the storage.
Edited to emphasize not local storage and not a single page web app