Skip to content

Commit

Permalink
type bug
Browse files Browse the repository at this point in the history
  • Loading branch information
a3318375 committed Apr 26, 2024
1 parent 4c2f910 commit 9532993
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/pages/(base)/article/blog/add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import { MdEditor } from "md-editor-rt";
import 'md-editor-rt/lib/style.css';
import http from "@/services/axios.ts";

type SelectType = {
label: string,
value: number,
obj: TagType
};
type TagType = {
id: number,
name: string,
};

export default function BlogAdd() {
const [ text, setText ] = useState('');
return (
Expand Down Expand Up @@ -45,10 +55,14 @@ export default function BlogAdd() {
name="typeList"
label='分类'
request={async () => {
const tags = await http.get('/api/type/list');
const tagResp = []
tags.forEach((tag) => {
const obj = {};
const tags = await http.get<TagType[]>('/api/type/list');
const tagResp: SelectType[] = []
tags.forEach((tag: TagType) => {
const obj = {
label: tag.name,
value: tag.id,
obj: tag,
}
obj.label = tag.name;
obj.value = tag.id;
obj.obj = tag;
Expand All @@ -63,10 +77,14 @@ export default function BlogAdd() {
label='标签'
mode='multiple'
request={async () => {
const tags = await http.get('/api/tag/list');
const tagResp = []
tags.forEach((tag) => {
const obj = {};
const tags = await http.get<TagType[]>('/api/tag/list');
const tagResp: SelectType[] = []
tags.forEach((tag: TagType) => {
const obj = {
label: tag.name,
value: tag.id,
obj: tag,
}
obj.label = tag.name;
obj.value = tag.id;
obj.obj = tag;
Expand Down

0 comments on commit 9532993

Please sign in to comment.