Skip to content

Commit

Permalink
fix: ngx_directives not update #218
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Dec 5, 2023
1 parent 4bab7b2 commit 26788f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions app/src/views/domain/DomainAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function init() {
})
}
function save() {
async function save() {
return ngx.build_config(ngx_config).then(r => {
// eslint-disable-next-line promise/no-nesting
domain.save(ngx_config.name, { name: ngx_config.name, content: r.content, overwrite: true }).then(() => {
Expand Down Expand Up @@ -82,8 +82,13 @@ async function next() {
await save()
current_step.value++
}
const ngx_directives = computed(() => {
return ngx_config.servers[0].directives
})
provide('save_site_config', save)
provide('ngx_directives', ngx_config.servers[0].directives)
provide('ngx_directives', ngx_directives)
provide('ngx_config', ngx_config)
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ function build_template() {
})
}
const ngx_directives = computed(() => {
return data.value?.directives
})
provide('build_template', build_template)
provide('ngx_directives', data.value?.directives)
provide('ngx_directives', ngx_directives)
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions app/src/views/domain/ngx_conf/directive/DirectiveEditor.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useGettext } from 'vue3-gettext'
import Draggable from 'vuedraggable'
import { provide } from 'vue'
import type { ComputedRef } from 'vue'
import DirectiveAdd from './DirectiveAdd.vue'
import DirectiveEditorItem from '@/views/domain/ngx_conf/directive/DirectiveEditorItem.vue'
import type { NgxDirective } from '@/api/ngx'
Expand All @@ -13,7 +13,7 @@ defineProps<{
const { $gettext } = useGettext()
const current_idx = ref(-1)
const ngx_directives = inject('ngx_directives') as NgxDirective[]
const ngx_directives = inject('ngx_directives') as ComputedRef<NgxDirective[]>
provide('current_idx', current_idx)
</script>
Expand Down

0 comments on commit 26788f3

Please sign in to comment.