import * as React from "react"; export interface Me { username: string; admin: boolean; version: string; // proddy added } export interface AuthenticationContext { refresh: () => void; signIn: (accessToken: string) => void; signOut: () => void; me?: Me; } const AuthenticationContextDefaultValue = {} as AuthenticationContext export const AuthenticationContext = React.createContext( AuthenticationContextDefaultValue ); export interface AuthenticationContextProps { authenticationContext: AuthenticationContext; } export function withAuthenticationContext(Component: React.ComponentType) { return class extends React.Component> { render() { return ( {authenticationContext => } ); } }; } export interface AuthenticatedContext extends AuthenticationContext { me: Me; } const AuthenticatedContextDefaultValue = {} as AuthenticatedContext export const AuthenticatedContext = React.createContext( AuthenticatedContextDefaultValue ); export interface AuthenticatedContextProps { authenticatedContext: AuthenticatedContext; } export function withAuthenticatedContext(Component: React.ComponentType) { return class extends React.Component> { render() { return ( {authenticatedContext => } ); } }; }