Skip to content

Commit

Permalink
popup setting test-net only
Browse files Browse the repository at this point in the history
  • Loading branch information
planethouki committed Aug 19, 2021
1 parent 150bd99 commit b64218a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</template>
<template v-else>
<div class="mb-3">
<label for="inputNode" class="form-label">Node</label>
<label for="inputNode" class="form-label">Node (TestNet Only)</label>
<input
type="text"
class="form-control"
Expand All @@ -15,6 +15,7 @@
<button type="button" class="btn btn-primary" @click="save">Save</button>
<span class="px-1"></span>
<button type="button" class="btn btn-secondary" @click="back">Back</button>
<span>{{ settingMessage }}</span>
</div>
<hr />
<div class="mb-3">
Expand All @@ -31,6 +32,7 @@
import FactorySet from '@/components/FactorySet.vue'
import SettingsSaveRequest from '@/assets/models/SettingsSaveRequest'
import { v4 as uuid } from 'uuid'
import network from '../assets/utils/network'
export default {
name: 'Settings',
Expand All @@ -44,14 +46,28 @@ export default {
data () {
return {
inputNode: '',
isShowResetConfirm: false
isShowResetConfirm: false,
settingMessage: '',
resetMessage: ''
}
},
created () {
this.inputNode = this.nem2.getEndPoint()
},
methods: {
save () {
async save () {
const checkNode = await network.checkNode(this.inputNode)
if (checkNode.success === false) {
this.settingMessage = 'cannot access node'
return
}
if (checkNode.data.isTestNet === false) {
this.settingMessage = 'Only Testnet is supported.'
return
}
const request = new SettingsSaveRequest(uuid(), this.inputNode)
this.$emit('save', request)
},
Expand Down

0 comments on commit b64218a

Please sign in to comment.