generated from kevisual/vite-react-template
feat: add Gitea configuration page and state management
- Implemented GiteaConfigPage for managing Gitea API settings. - Created Zustand store for Gitea configuration with local storage persistence. - Added validation schema for Gitea configuration using Zod. - Established routes for Gitea configuration in the application.
This commit is contained in:
@@ -2,7 +2,9 @@ import { QueryRouterServer } from '@kevisual/router/browser'
|
||||
|
||||
import { useContextKey } from '@kevisual/context'
|
||||
import { useConfigStore } from '@/app/config/store'
|
||||
import { useGiteaConfigStore } from '@/app/config/gitea/store'
|
||||
import { CNB } from '@kevisual/cnb'
|
||||
import { Gitea } from '@kevisual/gitea';
|
||||
export const app = useContextKey('app', new QueryRouterServer())
|
||||
|
||||
export const cnb: CNB = useContextKey('cnb', () => {
|
||||
@@ -27,4 +29,16 @@ export const cnb: CNB = useContextKey('cnb', () => {
|
||||
const url = 'https://kevisual.cn/root/cnb-ai/dist/app.js'
|
||||
setTimeout(() => {
|
||||
import(/* @vite-ignore */url)
|
||||
}, 2000)
|
||||
}, 2000)
|
||||
|
||||
export const gitea = useContextKey('gitea', () => {
|
||||
const state = useGiteaConfigStore.getState()
|
||||
const config = state.config || {}
|
||||
return new Gitea({
|
||||
token: config.GITEA_TOKEN,
|
||||
baseURL: config.GITEA_URL,
|
||||
cors: {
|
||||
baseUrl: 'https://cors.kevisual.cn'
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user