diff --git a/ui/autoMate/src/renderer/src/components/FooterMenu/index.tsx b/ui/autoMate/src/renderer/src/components/FooterMenu/index.tsx
index 0faf415..23c1610 100644
--- a/ui/autoMate/src/renderer/src/components/FooterMenu/index.tsx
+++ b/ui/autoMate/src/renderer/src/components/FooterMenu/index.tsx
@@ -1,10 +1,14 @@
import { Add, DatabaseConfig } from '@icon-park/react'
+import { useSubmit } from 'react-router-dom'
export const FooterMenu = () => {
+ const submit = useSubmit()
return (
<>
-
+
+ submit(null, {method:'POST'})
+ }/>
>
diff --git a/ui/autoMate/src/renderer/src/pages/Category/CategoryAction.ts b/ui/autoMate/src/renderer/src/pages/Category/CategoryAction.ts
new file mode 100644
index 0000000..55d4a05
--- /dev/null
+++ b/ui/autoMate/src/renderer/src/pages/Category/CategoryAction.ts
@@ -0,0 +1,7 @@
+export default async({request}) =>{
+ await window.api.sql(
+ "insert into categories (name, created_at) values('未命名', datetime())",
+ "create",
+ )
+ return {}
+}
diff --git a/ui/autoMate/src/renderer/src/pages/Category/CategoryLoader.ts b/ui/autoMate/src/renderer/src/pages/Category/CategoryLoader.ts
index 8f9672d..dbe6feb 100644
--- a/ui/autoMate/src/renderer/src/pages/Category/CategoryLoader.ts
+++ b/ui/autoMate/src/renderer/src/pages/Category/CategoryLoader.ts
@@ -1,3 +1,3 @@
export default () => {
- return window.api.sql("SELECT * FROM categories", "findAll")
+ return window.api.sql("SELECT * FROM categories order by id desc", "findAll")
}
\ No newline at end of file
diff --git a/ui/autoMate/src/renderer/src/router/index.tsx b/ui/autoMate/src/renderer/src/router/index.tsx
index a004c13..105cb10 100644
--- a/ui/autoMate/src/renderer/src/router/index.tsx
+++ b/ui/autoMate/src/renderer/src/router/index.tsx
@@ -10,6 +10,7 @@ import { Content } from "@renderer/pages/Content/Content";
import ContentAction from "@renderer/pages/Content/ContentAction";
import { Welcome } from "@renderer/pages/Welcome";
import ContentListAction from "@renderer/pages/ContentList/ContentListAction";
+import CategoryAction from "@renderer/pages/Category/CategoryAction";
const router = createHashRouter([
{
@@ -25,6 +26,7 @@ const router = createHashRouter([
// 界面第一次打开时,默认显示的页面
element: ,
loader: CategoryLoader,
+ action: CategoryAction,
children: [
{
path: "contentList/:cid?",