Skip to content

Commit

Permalink
CW-Webiew
Browse files Browse the repository at this point in the history
Added check for user
  • Loading branch information
pvm-code committed Dec 11, 2023
1 parent e96f679 commit 20ff8a3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath } from "@/shared/utils";
import firebase from "@/shared/utils/firebase";
import { parseJson } from "@/shared/utils/json";

const WebViewLoginHandler: FC = () => {
const dispatch = useDispatch();

const handleWebviewLogin = React.useCallback((event) => {
const handleWebviewLogin = React.useCallback(async (event) => {
const data = parseJson(event.data) as FirebaseCredentials;
const user = await firebase.auth().currentUser;

if (data?.redirectUrl) {
history.push(data?.redirectUrl);
}
if (!data?.providerId) {
if (!data?.providerId || !!user) {
return;
}

Expand Down

0 comments on commit 20ff8a3

Please sign in to comment.