Skip to content

Commit

Permalink
fix: contacts store fetch after key import
Browse files Browse the repository at this point in the history
Signed-off-by: Svetoslav Borislavov <[email protected]>
  • Loading branch information
SvetBorislavov committed Jan 15, 2025
1 parent 744bfec commit 8cd0d21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { reactive, watch } from 'vue';
import { Prisma } from '@prisma/client';
import useUserStore from '@renderer/stores/storeUser';
import useContactsStore from '@renderer/stores/storeContacts';
import { useToast } from 'vue-toast-notification';
import usePersonalPassword from '@renderer/composables/usePersonalPassword';
Expand All @@ -14,6 +15,7 @@ import {
assertUserLoggedIn,
getErrorMessage,
isLoggedInOrganization,
safeAwait,
safeDuplicateUploadKey,
} from '@renderer/utils';
Expand All @@ -32,6 +34,7 @@ const emit = defineEmits(['update:show']);
/* Stores */
const user = useUserStore();
const contacts = useContactsStore();
/* Composables */
const toast = useToast();
Expand Down Expand Up @@ -78,6 +81,7 @@ const handleImportExternalKey = async () => {
await user.storeKey(keyPair, null, personalPassword, false);
await user.refetchUserState();
await safeAwait(contacts.fetch());
emit('update:show', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import { computed, ref } from 'vue';
import useUserStore from '@renderer/stores/storeUser';
import useContactsStore from '@renderer/stores/storeContacts';
import { useToast } from 'vue-toast-notification';
import usePersonalPassword from '@renderer/composables/usePersonalPassword';
import { hashData } from '@renderer/services/electronUtilsService';
import { getKeysFromSecretHash, getRecoveryPhraseHashValue } from '@renderer/utils';
import { getKeysFromSecretHash, getRecoveryPhraseHashValue, safeAwait } from '@renderer/utils';
import DecryptKeyModal from '@renderer/components/KeyPair/ImportEncrypted/components/DecryptKeyModal.vue';
Expand All @@ -25,6 +26,7 @@ const emit = defineEmits<{
/* Stores */
const user = useUserStore();
const contacts = useContactsStore();
/* Composables */
const toast = useToast();
Expand Down Expand Up @@ -101,6 +103,7 @@ async function end() {
await user.refetchKeys();
user.refetchAccounts();
await user.refetchUserState();
safeAwait(contacts.fetch());
}
function reset() {
Expand Down
3 changes: 3 additions & 0 deletions front-end/src/renderer/pages/RestoreKey/RestoreKey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PrivateKey } from '@hashgraph/sdk';
import { Prisma } from '@prisma/client';
import useUserStore from '@renderer/stores/storeUser';
import useContactsStore from '@renderer/stores/storeContacts';
import { useRouter } from 'vue-router';
import { useToast } from 'vue-toast-notification';
Expand All @@ -30,6 +31,7 @@ import RecoveryPhraseNicknameInput from '@renderer/components/RecoveryPhrase/Rec
/* Stores */
const user = useUserStore();
const contacts = useContactsStore();
/* Composables */
const toast = useToast();
Expand Down Expand Up @@ -164,6 +166,7 @@ const handleSaveKey = async () => {
toast.success('Key pair saved');
router.push({ name: 'settingsKeys' });
await safeAwait(contacts.fetch());
} catch (error) {
toast.error(getErrorMessage(error, 'Failed to store private key'));
} finally {
Expand Down

0 comments on commit 8cd0d21

Please sign in to comment.