mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
refactor login flow and hooks, address autologin issues
This commit is contained in:
parent
dcd6dc00f4
commit
bd2382c94e
43 changed files with 2179 additions and 484 deletions
|
|
@ -2,7 +2,10 @@ import { createContext, useContext, useState, ReactNode } from 'react';
|
|||
import { WebClient } from '@app/websocket';
|
||||
import { createWebClientRequest, createWebClientResponse } from '@app/api';
|
||||
|
||||
const WebClientContext = createContext<WebClient | null>(null);
|
||||
// Exported so integration tests can inject the WebClient singleton built
|
||||
// by their shared setup without going through the production provider
|
||||
// (which would attempt to `new WebClient(...)` a second time and throw).
|
||||
export const WebClientContext = createContext<WebClient | null>(null);
|
||||
|
||||
export function WebClientProvider({ children }: { children: ReactNode }) {
|
||||
const [client] = useState(() => new WebClient(createWebClientRequest(), createWebClientResponse()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue