@hhgtech/hhg-components
Version:
Hello Health Group common components
49 lines (48 loc) • 1.85 kB
TypeScript
import { UserInfo } from "../../types";
export declare const locale: string;
export declare const websiteId: string;
export declare const defaultAreaCode: string;
export declare const getSSOV2ApiUrl: (path: string) => string;
export declare const getSSOApiUrl: (path: string) => string;
export declare const BEARER_TOKEN_COOKIE = "hhg_user_token";
export type ReturnType<T = any> = {
_status: number;
_messages: string[];
_data: T | null;
code?: string;
};
export declare const fetchSSOV2Api: <T>(path: string, options?: RequestInit, noAuth?: boolean) => Promise<ReturnType<T>>;
export declare const fetchSSOApi: <T>(path: string, options?: RequestInit, noAuth?: boolean) => Promise<ReturnType<T>>;
export declare const resetPassword: (password: string, confirmPassword: string) => Promise<ReturnType<LoggedInResponseType>>;
export declare const checkUserExist: ({ email, phone, }: {
email?: string;
phone?: string;
}) => Promise<ReturnType<{
provider: string;
is_pass: boolean;
is_status: string;
}>>;
export declare const updateUserInfo: (data: {
name?: string;
birthday?: string;
email?: string;
password?: string;
confirm_password?: string;
phone_number?: string;
area_code?: string;
gender?: number;
validate?: string;
source?: string;
}) => Promise<ReturnType<LoggedInResponseType>>;
export type LoggedInResponseType = {
is_status: string;
provider: string;
token_type: string;
token: string;
refresh_token: string;
expire_in: number;
};
export declare const GoogleAuthClientId: string;
export declare const FacebookAppId = "2759888574045636";
export declare const getUserInfo: () => Promise<ReturnType<UserInfo>>;
export declare const handleAuthSuccess: (res: LoggedInResponseType) => void;