create a blog insert api

This commit is contained in:
simple321vip
2022-04-20 23:19:42 +08:00
parent e3be0674d8
commit e966d15e5e
2 changed files with 29 additions and 2 deletions
+16 -1
View File
@@ -25,7 +25,7 @@ import MdEditor from 'md-editor-v3';
import 'md-editor-v3/lib/style.css';
import { get_user_blogs } from '../../api/blog'
import { Blog, BlogType } from '../../entity/index'
import { update_blog_type } from '../../api/blog'
import { update_blog_type, insert_blog_type } from '../../api/blog'
import Tab from '../../components/common/Tab.vue'
let text = ref<string>("")
@@ -64,6 +64,21 @@ get_user_blogs({}).then(response => {
});
blog_type_list.push(blog_type)
});
}).then(() => {
if (blog_type_list.length == 0) {
const data = {
blog_type_name: '未分类'
}
insert_blog_type(data).then(response => {
if (response.data) {
blog_type_list.push({
blog_type_id: response.data.blog_type_id,
blog_type_name: response.data.blog_type_id,
blog_list: []
})
}
})
}
})
const handleCheck = (id: string) => {
return type_tab.id == id