|
18 | 18 | async function updateVerificationEmail() { |
19 | 19 | showVerificationDropdown = false; |
20 | 20 | try { |
21 | | - await sdk |
| 21 | + const userUpdated = await sdk |
22 | 22 | .forProject(page.params.region, page.params.project) |
23 | 23 | .users.updateEmailVerification({ |
24 | 24 | userId: $user.$id, |
25 | 25 | emailVerification: !$user.emailVerification |
26 | 26 | }); |
27 | | - await invalidate(Dependencies.USER); |
| 27 | +
|
28 | 28 | addNotification({ |
29 | | - message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${ |
30 | | - !$user.emailVerification ? 'unverified' : 'verified' |
| 29 | + message: `${userUpdated.name || userUpdated.email || userUpdated.phone || 'The account'} has been ${ |
| 30 | + !userUpdated.emailVerification ? 'unverified' : 'verified' |
31 | 31 | }`, |
32 | 32 | type: 'success' |
33 | 33 | }); |
34 | 34 | trackEvent(Submit.UserUpdateVerificationEmail); |
| 35 | + await invalidate(Dependencies.USER); |
35 | 36 | } catch (error) { |
36 | 37 | addNotification({ |
37 | 38 | message: error.message, |
|
43 | 44 | async function updateVerificationPhone() { |
44 | 45 | showVerificationDropdown = false; |
45 | 46 | try { |
46 | | - await sdk |
| 47 | + const userUpdated = await sdk |
47 | 48 | .forProject(page.params.region, page.params.project) |
48 | 49 | .users.updatePhoneVerification({ |
49 | 50 | userId: $user.$id, |
50 | 51 | phoneVerification: !$user.phoneVerification |
51 | 52 | }); |
52 | | - await invalidate(Dependencies.USER); |
| 53 | +
|
53 | 54 | addNotification({ |
54 | | - message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${ |
55 | | - $user.phoneVerification ? 'unverified' : 'verified' |
| 55 | + message: `${userUpdated.name || userUpdated.email || userUpdated.phone || 'The account'} has been ${ |
| 56 | + !userUpdated.phoneVerification ? 'unverified' : 'verified' |
56 | 57 | }`, |
57 | 58 | type: 'success' |
58 | 59 | }); |
| 60 | + await invalidate(Dependencies.USER); |
59 | 61 | trackEvent(Submit.UserUpdateVerificationPhone); |
60 | 62 | } catch (error) { |
61 | 63 | addNotification({ |
|
0 commit comments