refactor and fix create wallet bug

This commit is contained in:
Kyle Zsembery 2020-09-03 11:18:40 +10:00
parent b7c7fc50ae
commit 92427dd3fa
12 changed files with 23 additions and 21 deletions

View File

@ -22,7 +22,7 @@
<script>
import { mapState } from "vuex";
import LNSInputForm from "components/lns_input_form";
import LNSInputForm from "./lns_input_form";
import WalletPassword from "src/mixins/wallet_password";
const objectAssignDeep = require("object-assign-deep");

View File

@ -58,7 +58,7 @@ import { required, decimal } from "vuelidate/lib/validators";
import { service_node_key, greater_than_zero } from "src/validators/common";
import LokiField from "components/loki_field";
import WalletPassword from "src/mixins/wallet_password";
import ServiceNodeUnlock from "components/service_node_unlock";
import ServiceNodeUnlock from "./service_node_unlock";
export default {
name: "ServiceNodeStaking",

View File

@ -64,7 +64,7 @@ import { required } from "vuelidate/lib/validators";
import { service_node_key } from "src/validators/common";
import WalletPassword from "src/mixins/wallet_password";
import FormatLoki from "components/format_loki";
import ServiceNodeDetails from "components/service_node_details";
import ServiceNodeDetails from "./service_node_details";
export default {
name: "ServiceNodeUnlock",

View File

@ -31,7 +31,7 @@
<script>
import { mapState } from "vuex";
import FormatLoki from "components/format_loki";
import WalletSettings from "components/wallet_settings";
import WalletSettings from "components/menus/wallet_settings";
import CopyIcon from "components/icons/copy_icon";
export default {
name: "WalletDetails",

View File

@ -115,6 +115,12 @@ export default {
}
},
methods: {
createWallet() {
this.$q.loading.show({
delay: 0
});
this.$gateway.send("wallet", "create_wallet", this.wallet);
},
create() {
this.$v.wallet.$touch();
@ -136,10 +142,8 @@ export default {
}
// Warn user if no password is set
let passwordPromise = Promise.resolve();
if (!this.wallet.password) {
// TODO: Password box de-duplicate across components
passwordPromise = this.$q.dialog({
const passwordPromise = this.$q.dialog({
title: this.$t("dialog.noPassword.title"),
message: this.$t("dialog.noPassword.message"),
ok: {
@ -153,17 +157,15 @@ export default {
dark: this.theme == "dark",
color: "positive"
});
passwordPromise
.onOk(() => {
this.createWallet();
})
.onDismiss(() => {})
.onCancel(() => {});
} else {
this.createWallet();
}
passwordPromise
.onOk(() => {
this.$q.loading.show({
delay: 0
});
this.$gateway.send("wallet", "create_wallet", this.wallet);
})
.onDismiss(() => {})
.onCancel(() => {});
},
cancel() {
this.$router.replace({ path: "/wallet-select" });

View File

@ -6,8 +6,8 @@
</template>
<script>
import LNSInput from "components/lns_input";
import LNSRecordList from "components/lns_record_list";
import LNSInput from "components/lns/lns_input";
import LNSRecordList from "components/lns/lns_record_list";
export default {
components: {

View File

@ -23,8 +23,8 @@
</template>
<script>
import ServiceNodeStaking from "components/service_node_staking";
import ServiceNodeRegistration from "components/service_node_registration";
import ServiceNodeStaking from "components/service_node/service_node_staking";
import ServiceNodeRegistration from "components/service_node/service_node_registration";
export default {
components: {
ServiceNodeStaking,