This commit is contained in:
xiongxiao
2026-01-13 17:04:43 +08:00
parent 1d7a51f76c
commit cedf3236b0
6 changed files with 39 additions and 384 deletions

View File

@@ -1,12 +1,15 @@
import { QueryRouterServer as App } from '@kevisual/router'
import { useContextKey } from '@kevisual/context'
import { useConfig } from '@kevisual/use-config'
import { useConfig, useKey } from '@kevisual/use-config'
import { CNB } from '../src/index.ts';
import { nanoid } from 'nanoid';
export const config = useConfig()
export const cnb = useContextKey<CNB>('cnb', () => {
return new CNB({ token: config.CNB_TOKEN, cookie: config.CNB_COOKIE, group: config.CNB_GROUP });
const token = useKey('CNB_TOKEN') as string
const cookie = useKey('CNB_COOKIE') as string
return new CNB({ token: token, cookie: cookie });
})
export const appId = nanoid();
export const app = useContextKey<App>('app', () => {