Skip to content

Commit

Permalink
feat: correct modal follow up
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed Aug 3, 2023
1 parent 0258e1b commit 2e08d4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 37 deletions.
1 change: 1 addition & 0 deletions src/refactor/ui/components/modals/authenticate/index.tsx
@@ -1 +1,2 @@
export { AuthenticateModal } from './authenticate';
export { useAuthenticate } from './use-authenticate';
Expand Up @@ -47,8 +47,9 @@ export const useAuthenticate = ({
onAuthenticateSuccess,
onAuthenticateError,
onAuthenticateFinish: async () => {
const identityRefetched = await reloadIdentity();
if (!identityRefetched) await openSoulnameModal();
const { data: identityRefetched } = await reloadIdentity();
if (!identityRefetched || !identityRefetched.identityId)
await openSoulnameModal();
},
});
// await openSoulnameModal();
Expand Down
Expand Up @@ -4,7 +4,6 @@ import { useIdentityPurchase } from '../../../../masa/use-identity-purchase';
import { useConfig } from '../../../../base-provider';
import { useIdentity } from '../../../../masa/use-identity';
import { useCreateSoulnameModal } from './CreateSoulnameProvider';
import { useSoulNames } from '../../../../masa/use-soulnames';

const errorMessages = {
UNPREDICTABLE_GAS_LIMIT:
Expand All @@ -25,7 +24,6 @@ export const useRegisterSoulname = ({

const { identity } = useIdentity();
const { purchaseSoulName } = useSoulNamesPurchase();
const { soulnames } = useSoulNames();
const { purchaseIdentityWithSoulName } = useIdentityPurchase();
const {
soulname,
Expand All @@ -46,32 +44,15 @@ export const useRegisterSoulname = ({
return undefined;
}

console.log('HEY!!!!', { identity, soulnames });
try {
if (identity && identity.identityId) {
console.log('JUST SOULNAME');
console.log('DEBUG A', {
soulname,
registrationPeriod,
paymentMethod,
soulNameStyle,
});

const result = await purchaseSoulName(
soulname,
registrationPeriod,
paymentMethod,
soulNameStyle
);

console.log('DEBUG B', {
soulname,
registrationPeriod,
paymentMethod,
soulNameStyle,
result,
});

if (result) {
onMintSuccess?.();
}
Expand All @@ -83,28 +64,13 @@ export const useRegisterSoulname = ({
return result;
}

console.log('DEBUG1', {
paymentMethod,
soulname,
registrationPeriod,
soulNameStyle,
});

const result = await purchaseIdentityWithSoulName(
paymentMethod,
soulname,
registrationPeriod,
soulNameStyle
);

console.log('DEBUG2', {
paymentMethod,
soulname,
registrationPeriod,
soulNameStyle,
result
});

if (result) {
onMintSuccess?.();
}
Expand Down Expand Up @@ -147,7 +113,6 @@ export const useRegisterSoulname = ({
onMintSuccess,
onMintError,
setShowError,
soulnames
]);

return {
Expand Down

0 comments on commit 2e08d4d

Please sign in to comment.