Add create tool page

This commit is contained in:
2024-01-26 14:29:53 +08:00
parent 37fcfecbb7
commit 5fb4cfe55d
7 changed files with 240 additions and 51 deletions

View File

@@ -109,11 +109,18 @@ service.interceptors.response.use(
return response
},
async (error: AxiosError) => {
void message.error(
<>
<strong></strong>
</>
)
if (
error.code === 'ETIMEDOUT' ||
(error.code === 'ECONNABORTED' && error.message.includes('timeout'))
) {
void message.error('请求超时,请稍后重试')
} else {
void message.error(
<>
<strong></strong>
</>
)
}
return await Promise.reject(error?.response?.data)
}
)

11
src/services/tool.tsx Normal file
View File

@@ -0,0 +1,11 @@
import request from '@/services/index'
import { URL_TOOL, URL_TOOL_CATEGORY, URL_TOOL_TEMPLATE } from '@/constants/urls.constants'
export const r_tool_template_get = () => request.get<ToolTemplateVo[]>(URL_TOOL_TEMPLATE)
export const r_tool_template_get_one = (id: string) =>
request.get<ToolTemplateVo>(`${URL_TOOL_TEMPLATE}/${id}`)
export const r_tool_category_get = () => request.get<ToolCategoryVo[]>(URL_TOOL_CATEGORY)
export const r_tool_create = (param: ToolCreateParam) => request.post<ToolVo>(URL_TOOL, param)