refactor: update CreateKnowledgeDialog to refresh user profile after knowledge creation

This commit is contained in:
CaptainB 2025-07-04 13:53:32 +08:00
parent f3e5f26caf
commit 4214043674
3 changed files with 18 additions and 0 deletions

View File

@ -29,8 +29,10 @@ import BaseForm from '@/views/knowledge/component/BaseForm.vue'
import { MsgSuccess, MsgAlert } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { t } from '@/locales'
import useStore from "@/stores";
const emit = defineEmits(['refresh'])
const { user } = useStore()
const router = useRouter()
const route = useRoute()
const apiType = computed(() => {
@ -67,6 +69,10 @@ const submitHandle = async () => {
}
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.postKnowledge(obj, loading)
.then(async (res: any) => {
await user.profile();
return res
})
.then((res: any) => {
MsgSuccess(t('common.createSuccess'))
router.push({

View File

@ -58,8 +58,10 @@ import BaseForm from '@/views/knowledge/component/BaseForm.vue'
import { MsgSuccess, MsgAlert } from '@/utils/message'
import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import useStore from "@/stores";
const emit = defineEmits(['refresh'])
const { user } = useStore()
const router = useRouter()
const route = useRoute()
const apiType = computed(() => {
@ -159,6 +161,10 @@ const submitHandle = async () => {
}
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.postLarkKnowledge(obj, loading)
.then(async (res: any) => {
await user.profile();
return res
})
.then((res: any) => {
MsgSuccess(t('common.createSuccess'))
router.push({

View File

@ -50,8 +50,10 @@ import BaseForm from '@/views/knowledge/component/BaseForm.vue'
import { MsgSuccess, MsgAlert } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { t } from '@/locales'
import useStore from "@/stores";
const emit = defineEmits(['refresh'])
const { user } = useStore()
const router = useRouter()
const route = useRoute()
const apiType = computed(() => {
@ -113,6 +115,10 @@ const submitHandle = async () => {
}
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.postWebKnowledge(obj, loading)
.then(async (res: any) => {
await user.profile();
return res
})
.then((res: any) => {
MsgSuccess(t('common.createSuccess'))
router.push({