mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-04 21:19:53 +08:00
29 lines
800 B
TypeScript
29 lines
800 B
TypeScript
import * as React from "react";
|
|
import { StatelessComponent } from "react";
|
|
import { UserAuthWrapper } from "redux-auth-wrapper";
|
|
|
|
const Auth = UserAuthWrapper<any, any, any>({
|
|
allowRedirectBack: true,
|
|
authenticatingSelector(state: any) {
|
|
return state.auth.loading;
|
|
},
|
|
authSelector(state: any) {
|
|
return state.auth;
|
|
},
|
|
FailureComponent: () => (<div />),
|
|
failureRedirectPath: "/401",
|
|
LoadingComponent: () => (<div />),
|
|
redirectAction: () => ({ type : "redirect" }),
|
|
redirectQueryParamName: "next",
|
|
predicate(authData: any) {
|
|
return authData.authorized;
|
|
},
|
|
wrapperDisplayName: "TestAuth"
|
|
});
|
|
|
|
export const TestAuthComponent: StatelessComponent<any> = () => {
|
|
return (<div />);
|
|
};
|
|
|
|
const TestAuth = Auth(TestAuthComponent);
|