Return boolean for new user
This commit is contained in:
parent
616ead7ae5
commit
2d3242aad3
@ -59,7 +59,7 @@ export const AutoSignIn = () => {
|
||||
useEffect(() => {
|
||||
const getAccountAddress = async (event: MessageEvent) => {
|
||||
if (event.data.type !== 'GET_ACCOUNT_ADDRESS') return;
|
||||
|
||||
let isNewUser = false;
|
||||
|
||||
if (event.data.secret !== process.env.REACT_APP_AUTH_SECRET) {
|
||||
console.log('Unauthorized app.');
|
||||
@ -72,6 +72,8 @@ export const AutoSignIn = () => {
|
||||
console.log("Accounts not found, creating wallet...");
|
||||
await createWallet(networksData);
|
||||
|
||||
isNewUser = true
|
||||
|
||||
// Re-fetch newly created accounts
|
||||
accountsData = await getAccountsData(event.data.chainId);
|
||||
}
|
||||
@ -80,7 +82,7 @@ export const AutoSignIn = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage(event.source as Window, 'ACCOUNT_ADDRESS_RESPONSE', accountsData[0].address, event.origin);
|
||||
sendMessage(event.source as Window, 'ACCOUNT_ADDRESS_RESPONSE', { address: accountsData[0].address, isNewUser }, event.origin);
|
||||
};
|
||||
|
||||
window.addEventListener('message', getAccountAddress);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user