Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: universal login #136

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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