Browse Source

fix: site adding issues

1. Fix the issue of being unable to save when adding a website
2. Fix the issue of being unable to apply for a certificate after adding a website for the first time
0xJacky 2 năm trước cách đây
mục cha
commit
2f08fe3286
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      frontend/src/views/domain/DomainAdd.vue

+ 5 - 5
frontend/src/views/domain/DomainAdd.vue

@@ -12,8 +12,8 @@ import template from '@/api/template'
 
 const {$gettext, interpolate} = useGettext()
 
-const config = reactive({name: ''})
 const ngx_config = reactive({
+    name: '',
     servers: [{
         directives: [],
         locations: []
@@ -40,10 +40,10 @@ function init() {
 
 function save() {
     ngx.build_config(ngx_config).then(r => {
-        domain.save(config.name, {name: config.name, content: r.content}).then(() => {
+        domain.save(ngx_config.name, {name: ngx_config.name, content: r.content, overwrite: true}).then(() => {
             message.success($gettext('Saved successfully'))
 
-            domain.enable(config.name).then(() => {
+            domain.enable(ngx_config.name).then(() => {
                 message.success($gettext('Enabled successfully'))
                 current_step.value++
                 window.scroll({top: 0, left: 0, behavior: 'smooth'})
@@ -93,7 +93,7 @@ const has_server_name = computed(() => {
             <template v-if="current_step===0">
                 <a-form layout="vertical">
                     <a-form-item :label="$gettext('Configuration Name')">
-                        <a-input v-model:value="config.name"/>
+                        <a-input v-model:value="ngx_config.name"/>
                     </a-form-item>
                 </a-form>
 
@@ -131,7 +131,7 @@ const has_server_name = computed(() => {
                 <a-button
                     type="primary"
                     @click="save"
-                    :disabled="!config.name||!has_server_name"
+                    :disabled="!ngx_config.name||!has_server_name"
                 >
                     <translate>Next</translate>
                 </a-button>