Skip to content

Commit

Permalink
Merge pull request #568 from fairDataSociety/fix/metamask-migration-d…
Browse files Browse the repository at this point in the history
…ialog

fix: metamask migration dialog
  • Loading branch information
tfius authored Dec 13, 2023
2 parents 11e0bdb + b736655 commit 1debe97
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function MetamaskCreateAccount({

await fdpClientRef.current.account.register(request);
setWallet(fdpClientRef.current.account.wallet);
setFdpStorageType('native');
setFdpStorageType('native', undefined, false);
setIsLoggedIn(true);
setLoginType('username');
setUser(username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const MetamaskMigrationDialog = ({
if (clickOutside) {
return;
}
setMetamaskMigrationNotification('closed');
setMetamaskMigrationNotification(
step === Step.COMPLETE ? 'completed' : 'closed'
);
onClose();
};

Expand Down
21 changes: 13 additions & 8 deletions src/context/FdpStorageContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ interface FdpStorageContext {
setWallet: (wallet: Wallet) => void;
setFdpStorageType: (
type: FDP_STORAGE_TYPE,
config?: FdpContracts.EnsEnvironment
config?: FdpContracts.EnsEnvironment,
create?: boolean
) => void;
setFdpStorageConfig: (config: FdpContracts.EnsEnvironment) => void;
setUsername: (username: string) => void;
Expand Down Expand Up @@ -153,15 +154,19 @@ function FdpStorageProvider(props: FdpStorageContextProps) {
*/
const setFdpStorageType = (
type: FDP_STORAGE_TYPE,
config?: FdpContracts.EnsEnvironment
config?: FdpContracts.EnsEnvironment,
create = true
) => {
if (type === 'native') {
fdpClientRef.current = createFdpStorage(config);
} else if (type === 'blossom') {
fdpClientRef.current = blossom.fdpStorage;
} else {
throw new Error('Unknown FDP storage type');
if (create) {
if (type === 'native') {
fdpClientRef.current = createFdpStorage(config);
} else if (type === 'blossom') {
fdpClientRef.current = blossom.fdpStorage;
} else {
throw new Error('Unknown FDP storage type');
}
}

setIsLoggedIn(false);
setStorageType(type);
};
Expand Down

0 comments on commit 1debe97

Please sign in to comment.