Refactor autoRefresh code

Refactor code to class and use CCApi function instead of calling the API
manually via fetch.

Change-Id: I5b7745ca076d58343e4902f2fc400112e592a9b2
diff --git a/src/contentScripts/communityConsole/main.js b/src/contentScripts/communityConsole/main.js
index 08e3e71..836fd1f 100644
--- a/src/contentScripts/communityConsole/main.js
+++ b/src/contentScripts/communityConsole/main.js
@@ -1,6 +1,6 @@
 import {injectScript, injectStyles, injectStylesheet} from '../../common/contentScriptsUtils.js';
 
-import {autoRefresh} from './autoRefresh.js';
+import AutoRefresh from './autoRefresh.js';
 import AvatarsHandler from './avatars.js';
 import {batchLock} from './batchLock.js';
 import {injectDarkModeButton, isDarkThemeOn} from './darkMode.js';
@@ -8,7 +8,7 @@
 import {injectPreviousPostsLinks} from './profileHistoryLink.js';
 import {unifiedProfilesFix} from './unifiedProfiles.js';
 
-var mutationObserver, intersectionObserver, intersectionOptions, options, avatars;
+var mutationObserver, intersectionObserver, intersectionOptions, options, avatars, autoRefresh;
 
 const watchedNodesSelectors = [
   // App container (used to set up the intersection observer and inject the dark
@@ -172,6 +172,9 @@
   if (options.threadlistavatars)
     avatars = new AvatarsHandler();
 
+  if (options.autorefreshlist)
+    autoRefresh = new AutoRefresh();
+
   // Before starting the mutation Observer, check whether we missed any
   // mutations by manually checking whether some watched nodes already
   // exist.