@orfeas126/box-ui-elements
Version:
Box UI Elements
41 lines (39 loc) • 1.31 kB
Flow
/**
* Flowtype definitions for withCurrentUser.tsx
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.10.0
*/
import React from "react";
import messages from "../messages";
import { withAPIContext } from "../api-context";
import { getBadItemError } from "../../../utils/error";
import { ElementsXhrError, ErrorContextProps } from "../../../common/types/api";
import { Errors } from "../flowTypes";
import { User } from "../../../common/types/core";
export type WithCurrentUserProps = {
currentUser?: User,
currentUserError?: Errors,
...
} & ErrorContextProps;
export type ComponentWithCurrentUser = {
errorCallback: (
error: ElementsXhrError,
code: string,
contextInfo: Object
) => void,
fetchCurrentUser: (user?: User, shouldDestroy?: boolean) => void,
fetchCurrentUserErrorCallback: (e: ElementsXhrError, code: string) => Errors,
fetchCurrentUserSuccessCallback: (currentUser: User) => void,
...
};
export type CurrentUserState = {
currentUser?: User,
currentUserError?: Errors,
...
};
export type WithCurrentUserComponent<P> = React.ComponentClass<
P & WithCurrentUserProps
>;
declare export default function withCurrentUser<P: { [key: string]: any }>(
WrappedComponent: React.ComponentType<P & WithCurrentUserProps>
): WithCurrentUserComponent<P>;