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(() => {
|
||||
if (!client) return;
|
||||
client.on("auth_response", (res) => {
|
||||
if (res.params.result.s) {
|
||||
setAddress(res.params.result.p.iss.split(":")[4]);
|
||||
client.on("auth_response", ({ params }) => {
|
||||
if ("code" in params) {
|
||||
console.error(params);
|
||||
return;
|
||||
}
|
||||
if ("error" in params) {
|
||||
console.error(params.error);
|
||||
return;
|
||||
}
|
||||
setAddress(params.result.p.iss.split(":")[4]);
|
||||
});
|
||||
}, [client]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user