refactor(auth-dapp): narrow type on auth_response
handler
This commit is contained in:
parent
44d11ddfbd
commit
e8c7bf9c0c
@ -48,10 +48,16 @@ const Home: NextPage = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!client) return;
|
if (!client) return;
|
||||||
client.on("auth_response", (res) => {
|
client.on("auth_response", ({ params }) => {
|
||||||
if (res.params.result.s) {
|
if ("code" in params) {
|
||||||
setAddress(res.params.result.p.iss.split(":")[4]);
|
console.error(params);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if ("error" in params) {
|
||||||
|
console.error(params.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setAddress(params.result.p.iss.split(":")[4]);
|
||||||
});
|
});
|
||||||
}, [client]);
|
}, [client]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user