v3: added opengraph support to the app, wrote README instructions incl. a Docker image
This commit is contained in:
@@ -35,6 +35,7 @@ interface WSProviderProps {
|
||||
children: ReactNode;
|
||||
token: string | null;
|
||||
userId: string | null;
|
||||
onForceLogout?: () => void;
|
||||
}
|
||||
|
||||
const MAX_BACKOFF = 30_000;
|
||||
@@ -54,7 +55,9 @@ function parseWSMessage(data: string): IncomingWSMessage | null {
|
||||
}
|
||||
}
|
||||
|
||||
export function WSProvider({ children, token, userId }: WSProviderProps) {
|
||||
export function WSProvider(
|
||||
{ children, token, userId, onForceLogout }: WSProviderProps,
|
||||
) {
|
||||
const [onlineUsers, setOnlineUsers] = useState<OnlineUser[]>([]);
|
||||
const [voteCounts, setVoteCounts] = useState<Record<string, number>>({});
|
||||
const [myVotes, setMyVotes] = useState<Set<string>>(new Set());
|
||||
@@ -264,6 +267,10 @@ export function WSProvider({ children, token, userId }: WSProviderProps) {
|
||||
break;
|
||||
}
|
||||
|
||||
case "force_logout":
|
||||
onForceLogout?.();
|
||||
break;
|
||||
|
||||
case "error":
|
||||
// On error, revert any pending optimistic update for the affected dump
|
||||
// (the revert timeout will handle it)
|
||||
|
||||
Reference in New Issue
Block a user