diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html
index b97cb3dfe..de010ed35 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.html
+++ b/src/app/pages/publications/view-publications/view-publications.page.html
@@ -65,7 +65,7 @@
-->
-
+
2" class="dots-container">
{
+ let service: CacheServiceService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(CacheServiceService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/cache-service.service.ts b/src/app/services/cache-service.service.ts
new file mode 100644
index 000000000..96a026ec4
--- /dev/null
+++ b/src/app/services/cache-service.service.ts
@@ -0,0 +1,39 @@
+import { Injectable } from '@angular/core';
+import { BehaviorSubject } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class CacheService {
+ // A HashMap to store the cache. The key is the page and the value is the data.
+ private cache = new Map();
+ // BehaviorSubject that will contain the updated cache data.
+ public cache$ = new BehaviorSubject(null);
+
+ // The 'set' method for storing data in the cache.
+ set(key: string, data: any[]): void {
+ // We check if data already exists for this key.
+ if (this.cache.has(key)) {
+ // If it already exists, we throw an exception to prevent overwriting the data.
+ throw new Error(`Data already exists for key '${key}'. Use a different key or delete the existing one first.`);
+ }
+ // If there is no data for this key, we store it in the cache and update the BehaviorSubject.
+ this.cache.set(key, data);
+ this.cache$.next(this.cache.get(key));
+ }
+
+ // The 'get' method for retrieving data from the cache.
+ get(key: string): any[] {
+ // We retrieve the data from the cache and update the BehaviorSubject.
+ const data = this.cache.get(key);
+ this.cache$.next(data);
+ return data;
+ }
+
+ // The 'clear' method to clear data from the cache.
+ clear(key: string): void {
+ // We remove the data from the cache and update the BehaviorSubject.
+ this.cache.delete(key);
+ this.cache$.next(null);
+ }
+}
\ No newline at end of file