feat(server): added in update server as well as get serverdata
This commit is contained in:
@@ -22,6 +22,7 @@ import { Route as OcpLotsImport } from './routes/ocp/lots'
|
||||
import { Route as EomEomImport } from './routes/_eom/eom'
|
||||
import { Route as AuthProfileImport } from './routes/_auth/profile'
|
||||
import { Route as AdminSettingsImport } from './routes/_admin/settings'
|
||||
import { Route as AdminServersImport } from './routes/_admin/servers'
|
||||
import { Route as AdminModulesImport } from './routes/_admin/modules'
|
||||
import { Route as logisticsMaterialHelperIndexImport } from './routes/(logistics)/materialHelper/index'
|
||||
import { Route as EomArticleAvImport } from './routes/_eom/article/$av'
|
||||
@@ -93,6 +94,12 @@ const AdminSettingsRoute = AdminSettingsImport.update({
|
||||
getParentRoute: () => AdminRoute,
|
||||
} as any)
|
||||
|
||||
const AdminServersRoute = AdminServersImport.update({
|
||||
id: '/servers',
|
||||
path: '/servers',
|
||||
getParentRoute: () => AdminRoute,
|
||||
} as any)
|
||||
|
||||
const AdminModulesRoute = AdminModulesImport.update({
|
||||
id: '/modules',
|
||||
path: '/modules',
|
||||
@@ -179,6 +186,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof AdminModulesImport
|
||||
parentRoute: typeof AdminImport
|
||||
}
|
||||
'/_admin/servers': {
|
||||
id: '/_admin/servers'
|
||||
path: '/servers'
|
||||
fullPath: '/servers'
|
||||
preLoaderRoute: typeof AdminServersImport
|
||||
parentRoute: typeof AdminImport
|
||||
}
|
||||
'/_admin/settings': {
|
||||
id: '/_admin/settings'
|
||||
path: '/settings'
|
||||
@@ -249,11 +263,13 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
interface AdminRouteChildren {
|
||||
AdminModulesRoute: typeof AdminModulesRoute
|
||||
AdminServersRoute: typeof AdminServersRoute
|
||||
AdminSettingsRoute: typeof AdminSettingsRoute
|
||||
}
|
||||
|
||||
const AdminRouteChildren: AdminRouteChildren = {
|
||||
AdminModulesRoute: AdminModulesRoute,
|
||||
AdminServersRoute: AdminServersRoute,
|
||||
AdminSettingsRoute: AdminSettingsRoute,
|
||||
}
|
||||
|
||||
@@ -287,6 +303,7 @@ export interface FileRoutesByFullPath {
|
||||
'/about': typeof AboutRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/modules': typeof AdminModulesRoute
|
||||
'/servers': typeof AdminServersRoute
|
||||
'/settings': typeof AdminSettingsRoute
|
||||
'/profile': typeof AuthProfileRoute
|
||||
'/eom': typeof EomEomRoute
|
||||
@@ -304,6 +321,7 @@ export interface FileRoutesByTo {
|
||||
'/about': typeof AboutRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/modules': typeof AdminModulesRoute
|
||||
'/servers': typeof AdminServersRoute
|
||||
'/settings': typeof AdminSettingsRoute
|
||||
'/profile': typeof AuthProfileRoute
|
||||
'/eom': typeof EomEomRoute
|
||||
@@ -324,6 +342,7 @@ export interface FileRoutesById {
|
||||
'/about': typeof AboutRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/_admin/modules': typeof AdminModulesRoute
|
||||
'/_admin/servers': typeof AdminServersRoute
|
||||
'/_admin/settings': typeof AdminSettingsRoute
|
||||
'/_auth/profile': typeof AuthProfileRoute
|
||||
'/_eom/eom': typeof EomEomRoute
|
||||
@@ -343,6 +362,7 @@ export interface FileRouteTypes {
|
||||
| '/about'
|
||||
| '/login'
|
||||
| '/modules'
|
||||
| '/servers'
|
||||
| '/settings'
|
||||
| '/profile'
|
||||
| '/eom'
|
||||
@@ -359,6 +379,7 @@ export interface FileRouteTypes {
|
||||
| '/about'
|
||||
| '/login'
|
||||
| '/modules'
|
||||
| '/servers'
|
||||
| '/settings'
|
||||
| '/profile'
|
||||
| '/eom'
|
||||
@@ -377,6 +398,7 @@ export interface FileRouteTypes {
|
||||
| '/about'
|
||||
| '/login'
|
||||
| '/_admin/modules'
|
||||
| '/_admin/servers'
|
||||
| '/_admin/settings'
|
||||
| '/_auth/profile'
|
||||
| '/_eom/eom'
|
||||
@@ -449,6 +471,7 @@ export const routeTree = rootRoute
|
||||
"filePath": "_admin.tsx",
|
||||
"children": [
|
||||
"/_admin/modules",
|
||||
"/_admin/servers",
|
||||
"/_admin/settings"
|
||||
]
|
||||
},
|
||||
@@ -475,6 +498,10 @@ export const routeTree = rootRoute
|
||||
"filePath": "_admin/modules.tsx",
|
||||
"parent": "/_admin"
|
||||
},
|
||||
"/_admin/servers": {
|
||||
"filePath": "_admin/servers.tsx",
|
||||
"parent": "/_admin"
|
||||
},
|
||||
"/_admin/settings": {
|
||||
"filePath": "_admin/settings.tsx",
|
||||
"parent": "/_admin"
|
||||
|
||||
14
frontend/src/routes/_admin/servers.tsx
Normal file
14
frontend/src/routes/_admin/servers.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import ServerPage from "@/components/admin/servers/ServerPage";
|
||||
import {createFileRoute} from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_admin/servers")({
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return (
|
||||
<div>
|
||||
<ServerPage />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
19
frontend/src/utils/querys/servers.tsx
Normal file
19
frontend/src/utils/querys/servers.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import {queryOptions} from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
export function getServers(token: string) {
|
||||
return queryOptions({
|
||||
queryKey: ["servers"],
|
||||
queryFn: () => fetchSettings(token),
|
||||
enabled: !!token,
|
||||
staleTime: 1000,
|
||||
refetchInterval: 500,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
const fetchSettings = async (token: string) => {
|
||||
const {data} = await axios.get("/api/server/servers", {headers: {Authorization: `Bearer ${token}`}});
|
||||
|
||||
return data.data;
|
||||
};
|
||||
Reference in New Issue
Block a user