Skip to content

Commit

Permalink
feat: universal login (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuricmp authored Nov 5, 2024
1 parent f00e4a0 commit dac561c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions mobile/app/home/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default function Page() {
};

const onPressLogout = async () => {
dispatch(clearLinking());
dispatch(logedOut());
};

Expand Down
16 changes: 11 additions & 5 deletions mobile/redux/features/accountSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ export const loggedIn = createAsyncThunk<User, LoginParam, ThunkExtra>("account/
});

async function getAccountName(bech32: string, gnonative: GnoNativeApi) {
const accountNameStr = await gnonative.qEval("gno.land/r/demo/users", `GetUserByAddress("${bech32}").Name`);
console.log("GetUserByAddress result:", accountNameStr);
const accountName = accountNameStr.match(/\("(\w+)"/)?.[1];
console.log("GetUserByAddress after regex", accountName);
return accountName
try {
console.log("GetUserByAddress request:", bech32);
const accountNameStr = await gnonative.qEval("gno.land/r/demo/users", `GetUserByAddress("${bech32}").Name`);
console.log("GetUserByAddress result:", accountNameStr);
const accountName = accountNameStr.match(/\("(\w+)"/)?.[1];
console.log("GetUserByAddress after regex", accountName);
return accountName
} catch (error) {
console.error("Error getting account name", error);
}
return undefined;
}

interface AvatarCallTxParams {
Expand Down

0 comments on commit dac561c

Please sign in to comment.