hunk.code_window:   }
     async registerTemplates(): Promise<any> {
       const templatePromises = [];
       for (let i = 0; i < this.templates.length; i += 1) {
         const waiting = await this.notifire.registerTemplate(this.templates[i]);
         templatePromises.push(waiting);
       }
  
hunk.labels: keep keep replace replace replace replace replace replace keep
hunk.after_edit:   async registerTemplates(): Promise<void> {
       for (const template of this.templates) {
         await this.notifire.registerTemplate(template);
  
hunk.file_path: packages/nest/src/services/notifire.service.ts
hunk.type: replace
file: import { useContext, useEffect, useState } from 'react';
  import io from 'socket.io-client';
  import { ISocket } from './socket.store';
  import { AuthContext, IAuthContext } from '../auth.context';
  import { WS_URL } from '../../api/shared';
  
  let socket;
  export function useSocketController() {
    const { token } = useContext<IAuthContext>(AuthContext);
    const [socketInstance, setSocketInstance] = useState<ISocket | null>(null);
  
    useEffect(() => {
      if (token && !socket) {
        socket = io(WS_URL, {
          reconnectionDelayMax: 10000,
          query: {
            token: `${token}`,
          },
        });
  
        socket.on('connect_error', function handleSocketConnectError(e) {
          // eslint-disable-next-line no-console
          console.error(e);
        });
  
        setSocketInstance(socket);
      }
  
      return () => {
        socket = null;
        socket?.disconnect();
      };
    }, [token]);
  
    return {
      socket: socketInstance,
    };
  }
  