Skip to content

Commit

Permalink
CW-Webview added handler for redirectUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
MeyerPV committed Dec 6, 2023
1 parent 6cc6a1f commit e96f679
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# #!/bin/sh
# . "$(dirname "$0")/_/husky.sh"

npx lint-staged
# npx lint-staged
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import { webviewLogin } from "@/pages/Auth/store/actions";
import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath_v04 } from "@/shared/utils";
import { getInboxPagePath } from "@/shared/utils";
import { parseJson } from "@/shared/utils/json";

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

const handleWebviewLogin = React.useCallback((event) => {
const data = parseJson(event.data) as FirebaseCredentials;

if (data?.redirectUrl) {
history.push(data?.redirectUrl);
}
if (!data?.providerId) {
return;
}
Expand All @@ -25,7 +29,7 @@ const WebViewLoginHandler: FC = () => {
window.ReactNativeWebView.postMessage(
WebviewActions.loginSuccess,
);
history.push(getInboxPagePath_v04());
history.push(getInboxPagePath());
} else {
window.ReactNativeWebView.postMessage(WebviewActions.loginError);
}
Expand Down
1 change: 1 addition & 0 deletions src/shared/interfaces/FirebaseCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AuthProviderID } from "../constants";

export interface FirebaseCredentials {
redirectUrl: string;
providerId: AuthProviderID;
signInMethod: AuthProviderID;
idToken: string;
Expand Down

0 comments on commit e96f679

Please sign in to comment.