Skip to content

Commit adac166

Browse files
feat(frontend): load user profile during login (#5460)
# Motivation We are going to save the enabled/disabled networks in the backend, in the user profile. So, we need to load the user profile before all the other services, to avoid doing work for disabled networks. # Changes - Add `loadUserProfile` in the `onMount` of `Loader` component, before the addresses. # Tests No changes in local replica. --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent d90cefc commit adac166

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/frontend/src/lib/components/loaders/Loader.svelte

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import { ProgressStepsLoader } from '$lib/enums/progress-steps';
2323
import { loadAddresses, loadIdbAddresses } from '$lib/services/addresses.services';
2424
import { signOut } from '$lib/services/auth.services';
25+
import { loadUserProfile } from '$lib/services/load-user-profile.services';
2526
import { initSignerAllowance } from '$lib/services/loader.services';
2627
import { i18n } from '$lib/stores/i18n.store';
2728
import { loading } from '$lib/stores/loader.store';
@@ -126,6 +127,15 @@
126127
const validateAddresses = () => emit({ message: 'oisyValidateAddresses' });
127128
128129
onMount(async () => {
130+
// The user profile settings will define the enabled/disabled networks.
131+
// So we need to load it first to enable/disable the rest of the services.
132+
const { success: userProfileSuccess } = await loadUserProfile({ identity: $authIdentity });
133+
134+
if (!userProfileSuccess) {
135+
await signOut({});
136+
return;
137+
}
138+
129139
const { success: addressIdbSuccess, err } = await loadIdbAddresses();
130140
131141
if (addressIdbSuccess) {

0 commit comments

Comments
 (0)