Skip to content

Commit d072d45

Browse files
committed
feat: add isEmailVerified data
1 parent 284df8a commit d072d45

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/auth/src/AuthContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ISubscribableAuthClient } from '@8base/auth';
44

55
export type AuthContextProps = {
66
isAuthorized: boolean;
7+
isEmailVerified?: boolean;
78
authState: IAuthState;
89
authClient: ISubscribableAuthClient;
910
};

packages/auth/src/AuthProvider.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type AuthProviderProps = {
1111

1212
type AuthProviderState = {
1313
isAuthorized: boolean;
14+
isEmailVerified?: boolean;
1415
authState: IAuthState;
1516
};
1617

@@ -54,8 +55,9 @@ class AuthProvider extends React.Component<AuthProviderProps, AuthProviderState>
5455

5556
const authState = authClient.getState();
5657
const isAuthorized = authClient.checkIsAuthorized();
58+
const isEmailVerified = authClient.checkIsEmailVerified && authClient.checkIsEmailVerified();
5759

58-
this.setState({ isAuthorized, authState });
60+
this.setState({ isAuthorized, isEmailVerified, authState });
5961
};
6062

6163
public componentDidMount() {
@@ -82,14 +84,15 @@ class AuthProvider extends React.Component<AuthProviderProps, AuthProviderState>
8284

8385
public render() {
8486
const { children, authClient } = this.props;
85-
const { isAuthorized, authState } = this.state;
87+
const { isAuthorized, isEmailVerified, authState } = this.state;
8688

8789
return (
8890
<AuthContext.Provider
8991
value={{
9092
authClient,
9193
authState,
9294
isAuthorized,
95+
isEmailVerified,
9396
}}
9497
>
9598
{children}

0 commit comments

Comments
 (0)