Skip to content

Commit

Permalink
Update connected.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
zach-herridge authored Jan 31, 2024
1 parent a8ddef3 commit 07fd476
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/pages/ggg/connected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@ export default function Connected() {
const { code, state } = router.query;
const { connect, jwt } = usePoeStackAuth();

useEffect(() => {
const stateRaw = state?.toString() ?? ""
if(stateRaw.includes("dawncode")) {
if(!!jwt) {
router.push(`https://bulk.poestack.com/auth?jwt=${jwt}`);
}
}
}, [jwt])

useEffect(() => {
if (code?.length) {
const codeRaw = code.toString()
const stateRaw = state?.toString() ?? ""
connect(codeRaw);


if (
!stateRaw.includes("dawncode") &&
typeof window !== "undefined" &&
localStorage.getItem("variable-redirect")
!stateRaw.includes("dawncode")
) {
router.push(localStorage.getItem("variable-redirect")!.toString());
connect(codeRaw);
if( typeof window !== "undefined" &&
localStorage.getItem("variable-redirect")) {
router.push(localStorage.getItem("variable-redirect")!.toString());
}

} else {
router.push(`https://bulk.poestack.com/ggg/connect?code=${codeRaw}`);
}
}
}, [code, connect, router]);
Expand Down

0 comments on commit 07fd476

Please sign in to comment.