[next] Admin Authentication (#2155)

* feat: Support sign in via E-Mail, and social logins + permission check

* feat: no permission info

* test: unit test

* test: fix remaining tests

* test: add integration tests

* feat: add admin account completion

* test: auth completion feature tests

* fix: translation

* fix: comment marker design

* fix: linting issues

* chore: address pr review comments

* chore: add comment
This commit is contained in:
Kiwi
2019-02-04 21:26:41 +00:00
committed by Wyatt Johnson
parent 939152ee81
commit 7e8ef2189d
143 changed files with 5991 additions and 2048 deletions
@@ -58,7 +58,7 @@ export interface TalkContext {
eventEmitter: EventEmitter2;
/** Clear session data. */
clearSession: () => void;
clearSession: () => Promise<void>;
}
const { Provider, Consumer } = React.createContext<TalkContext>({} as any);
@@ -251,7 +251,7 @@ export default async function createManaged({
uuidGenerator: uuid,
// Noop, this is later replaced by the
// managed TalkContextProvider.
clearSession: noop,
clearSession: () => Promise.resolve(),
};
// Initialize local state.
@@ -0,0 +1 @@
export { default as withRouteConfig } from "./withRouteConfig";
@@ -0,0 +1,33 @@
import { RouteProps } from "found";
import * as React from "react";
interface InjectedProps<T> {
error?: Error | null;
data: T | null | undefined;
retry?: Error | null;
}
type RouteConfig = Pick<RouteProps, "query"> &
Partial<Pick<RouteProps, "data" | "getData" | "defer">> & {
cacheConfig?: {
force?: boolean;
};
};
function withRouteConfig<QueryResponse>(config: RouteConfig) {
const hoc = <T extends InjectedProps<QueryResponse>>(
component: React.ComponentType<T>
) => {
(component as any).routeConfig = {
...config,
Component: component,
render: ({ error, props, retry, Component }: any) => {
return React.createElement(Component, { error, data: props, retry });
},
};
return component as React.ComponentClass<T> & { routeConfig: RouteConfig };
};
return hoc;
}
export default withRouteConfig;