Add WebSocket connection to client
Changes:
- On successful login, create a barebone WebSocket
- The access token is used for the authentification
GitLab: #49
Change-Id: I9aee9125fb8eb25273b198054909927350177b72
diff --git a/client/src/contexts/AuthProvider.tsx b/client/src/contexts/AuthProvider.tsx
index 50b1723..3bac10d 100644
--- a/client/src/contexts/AuthProvider.tsx
+++ b/client/src/contexts/AuthProvider.tsx
@@ -18,10 +18,11 @@
import { Account } from 'jami-web-common/dist/Account';
import { HttpStatusCode } from 'jami-web-common/dist/enums/http-status-code';
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
-import { Outlet, useNavigate } from 'react-router-dom';
+import { useNavigate } from 'react-router-dom';
import ProcessingRequest from '../components/ProcessingRequest';
import { apiUrl } from '../utils/constants';
+import { WithChildren } from '../utils/utils';
interface IAuthContext {
token: string;
@@ -31,7 +32,7 @@
const AuthContext = createContext<IAuthContext | undefined>(undefined);
-export default () => {
+export default ({ children }: WithChildren) => {
const [token, setToken] = useState<string | undefined>();
const [account, setAccount] = useState<Account | undefined>();
const navigate = useNavigate();
@@ -91,7 +92,7 @@
account,
}}
>
- <Outlet />
+ {children}
</AuthContext.Provider>
);
};