This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmnemonicModal.vue
90 lines (84 loc) · 1.92 KB
/
mnemonicModal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template lang="pug">
q-dialog(@hide="onDialogHide" persistent ref="dialog")
q-card.q-dialog-plugin.relative-position(
bordered
flat
style="width: 600px; height: 500px"
)
div
.q-ma-md
div
.row.justify-center.q-mb-md
.col
.row.q-mb-md
saveKeys(@userConfirm="userConfirm", :mnemonic="mnemonic")
.absolute-bottom.q-pa-md
.row.justify-end
q-btn(
:disabled="!userConfirmed"
@click="handleNextClick"
:label="$t('plottingProgress.next')"
outline
size="lg"
stretch
)
</template>
<script>
import { defineComponent } from 'vue';
import saveKeys from 'components/SaveKeys.vue';
import { useStore } from '../stores/store';
const component = defineComponent({
components: { saveKeys },
props: {
handleConfirm: {
type: Function,
required: true,
}
},
emits: [
// REQUIRED
'ok',
'hide'
],
setup() {
const store = useStore();
return { store };
},
data() {
return {
userConfirmed: false,
mnemonic: '',
};
},
async mounted() {
const { rewardAddress, mnemonic } = await this.$client.createRewardAddress();
this.store.setRewardAddress(rewardAddress);
this.mnemonic = mnemonic;
},
methods: {
userConfirm(val) {
this.userConfirmed = val;
},
// following method is REQUIRED
// (don't change its name --> "show")
show() {
this.$refs.dialog.show();
},
// following method is REQUIRED
// (don't change its name --> "hide")
hide() {
this.$refs.dialog.hide();
},
onDialogHide() {
// required to be emitted
// when QDialog emits "hide" event
this.$emit('hide');
},
async handleNextClick() {
this.hide();
await this.handleConfirm();
},
}
});
export default component;
</script>