Skip to content

Commit 26788f3

Browse files
committed
fix: ngx_directives not update #218
1 parent 4bab7b2 commit 26788f3

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

app/src/views/domain/DomainAdd.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function init() {
3434
})
3535
}
3636
37-
function save() {
37+
async function save() {
3838
return ngx.build_config(ngx_config).then(r => {
3939
// eslint-disable-next-line promise/no-nesting
4040
domain.save(ngx_config.name, { name: ngx_config.name, content: r.content, overwrite: true }).then(() => {
@@ -82,8 +82,13 @@ async function next() {
8282
await save()
8383
current_step.value++
8484
}
85+
86+
const ngx_directives = computed(() => {
87+
return ngx_config.servers[0].directives
88+
})
89+
8590
provide('save_site_config', save)
86-
provide('ngx_directives', ngx_config.servers[0].directives)
91+
provide('ngx_directives', ngx_directives)
8792
provide('ngx_config', ngx_config)
8893
</script>
8994

app/src/views/domain/ngx_conf/config_template/ConfigTemplate.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ function build_template() {
7272
})
7373
}
7474
75+
const ngx_directives = computed(() => {
76+
return data.value?.directives
77+
})
78+
7579
provide('build_template', build_template)
76-
provide('ngx_directives', data.value?.directives)
80+
provide('ngx_directives', ngx_directives)
7781
</script>
7882

7983
<template>

app/src/views/domain/ngx_conf/directive/DirectiveEditor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { useGettext } from 'vue3-gettext'
33
import Draggable from 'vuedraggable'
4-
import { provide } from 'vue'
4+
import type { ComputedRef } from 'vue'
55
import DirectiveAdd from './DirectiveAdd.vue'
66
import DirectiveEditorItem from '@/views/domain/ngx_conf/directive/DirectiveEditorItem.vue'
77
import type { NgxDirective } from '@/api/ngx'
@@ -13,7 +13,7 @@ defineProps<{
1313
const { $gettext } = useGettext()
1414
const current_idx = ref(-1)
1515
16-
const ngx_directives = inject('ngx_directives') as NgxDirective[]
16+
const ngx_directives = inject('ngx_directives') as ComputedRef<NgxDirective[]>
1717
1818
provide('current_idx', current_idx)
1919
</script>

0 commit comments

Comments
 (0)