mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix: use different strategy for domains not available in DomainForm in PostInstall
This commit is contained in:
parent
bdb283a80c
commit
6888ccb571
4 changed files with 8 additions and 9 deletions
|
@ -134,8 +134,7 @@ export function useDomains(
|
|||
const { mainDomain, domains: domains_, domainDetails } = useData()
|
||||
|
||||
const domains = computed(() => {
|
||||
if (!domains_.value && installed)
|
||||
throw new Error(getNoDataMessage('domains'))
|
||||
if (!domains_.value) throw new Error(getNoDataMessage('domains'))
|
||||
return domains_.value
|
||||
})
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@ async function performPostInstall(force = false) {
|
|||
<!-- DOMAIN SETUP STEP -->
|
||||
<template v-else-if="step === 'domain'">
|
||||
<DomainForm
|
||||
:domains="[]"
|
||||
:title="$t('postinstall_set_domain')"
|
||||
:submit-text="$t('next')"
|
||||
:server-error="serverError"
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { useDomains } from '@/composables/data'
|
||||
import { useForm } from '@/composables/form'
|
||||
import { useInfos } from '@/composables/useInfos'
|
||||
import {
|
||||
domain,
|
||||
dynDomain,
|
||||
|
@ -21,6 +19,7 @@ defineOptions({
|
|||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
domains: string[]
|
||||
title: string
|
||||
submitText?: string
|
||||
serverError?: string
|
||||
|
@ -35,14 +34,11 @@ const emit = defineEmits<{
|
|||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const { installed } = useInfos()
|
||||
|
||||
const { domains } = useDomains(undefined, installed.value)
|
||||
const dynDomains = ['nohost.me', 'noho.st', 'ynh.fr']
|
||||
|
||||
const dynDnsForbiden = computed(() => {
|
||||
if (!domains.value) return false
|
||||
return domains.value.some((domain) => {
|
||||
if (!props.domains) return false
|
||||
return props.domains.some((domain) => {
|
||||
return dynDomains.some((dynDomain) => domain.includes(dynDomain))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -4,12 +4,14 @@ import { useRouter } from 'vue-router'
|
|||
|
||||
import api from '@/api'
|
||||
import { APIBadRequestError, type APIError } from '@/api/errors'
|
||||
import { useDomains } from '@/composables/data'
|
||||
import { DomainForm } from '@/views/_partials'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
await api.fetch({ uri: 'domains', cachePath: 'domains' })
|
||||
|
||||
const { domains } = useDomains()
|
||||
const serverError = ref('')
|
||||
|
||||
function onSubmit(data: { domain: string; dyndns_recovery_password?: string }) {
|
||||
|
@ -32,6 +34,7 @@ function onSubmit(data: { domain: string; dyndns_recovery_password?: string }) {
|
|||
|
||||
<template>
|
||||
<DomainForm
|
||||
:domains="domains"
|
||||
:title="$t('domain_add')"
|
||||
:server-error="serverError"
|
||||
:submit-text="$t('add')"
|
||||
|
|
Loading…
Add table
Reference in a new issue