Skip to content

Commit

Permalink
Merge pull request #2391 from daostack/CW-Webview-sidebar
Browse files Browse the repository at this point in the history
CW-Webview Added user check for Login logic
  • Loading branch information
pvm-code authored Dec 12, 2023
2 parents f63018b + 2806409 commit 4f37d98
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath_v04 } 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;
if (!data?.providerId) {
const user = await firebase.auth().currentUser;
if (data?.redirectUrl) {
history.push(data?.redirectUrl);
}

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

Expand Down

0 comments on commit 4f37d98

Please sign in to comment.