ask before remove friendly instance
This commit is contained in:
parent
f0624b1457
commit
807f74c44b
1 changed files with 14 additions and 8 deletions
|
@ -46,7 +46,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapState } from 'vuex'
|
import { mapActions, mapState } from 'vuex'
|
||||||
import { Message } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -81,9 +81,7 @@ export default {
|
||||||
...mapActions(['setSetting']),
|
...mapActions(['setSetting']),
|
||||||
async createTrustedInstance () {
|
async createTrustedInstance () {
|
||||||
try {
|
try {
|
||||||
const instance = await axios
|
const instance = await axios.get(`${this.instance_url}/.well-known/nodeinfo/2.1`)
|
||||||
.get(`${this.instance_url}/.well-known/nodeinfo/2.1`)
|
|
||||||
console.error(instance)
|
|
||||||
this.setSetting({
|
this.setSetting({
|
||||||
key: 'trusted_instances',
|
key: 'trusted_instances',
|
||||||
value: this.settings.trusted_instances.concat({
|
value: this.settings.trusted_instances.concat({
|
||||||
|
@ -101,10 +99,18 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async deleteInstance (instance) {
|
deleteInstance (instance) {
|
||||||
await this.setSetting({
|
MessageBox.confirm(this.$t('admin.delete_trusted_instance_confirm'),
|
||||||
key: 'trusted_instances',
|
this.$t('common.confirm'), {
|
||||||
value: this.settings.trusted_instances.filter(i => i.url !== instance.url)
|
confirmButtonText: this.$t('common.ok'),
|
||||||
|
cancelButtonText: this.$t('common.cancel'),
|
||||||
|
type: 'error'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.setSetting({
|
||||||
|
key: 'trusted_instances',
|
||||||
|
value: this.settings.trusted_instances.filter(i => i.url !== instance.url)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
save (key, value) {
|
save (key, value) {
|
||||||
|
|
Loading…
Reference in a new issue