mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-13 15:57:01 +08:00
feat: add ESLint and Prettier with pre-commit hook
- Install ESLint 9 with TypeScript and React support - Install Prettier with custom configuration (no semicolons) - Add husky and lint-staged for pre-commit hooks - Configure lint-staged to auto-fix and format on commit - Relax ESLint rules to avoid large-scale code changes - Format all existing code with Prettier (no semicolons) Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
@@ -1,28 +1,26 @@
|
||||
export interface SystemConfig {
|
||||
admin_mode: boolean;
|
||||
beta_mode: boolean;
|
||||
admin_mode: boolean
|
||||
beta_mode: boolean
|
||||
}
|
||||
|
||||
let configPromise: Promise<SystemConfig> | null = null;
|
||||
let cachedConfig: SystemConfig | null = null;
|
||||
let configPromise: Promise<SystemConfig> | null = null
|
||||
let cachedConfig: SystemConfig | null = null
|
||||
|
||||
export function getSystemConfig(): Promise<SystemConfig> {
|
||||
if (cachedConfig) {
|
||||
return Promise.resolve(cachedConfig);
|
||||
return Promise.resolve(cachedConfig)
|
||||
}
|
||||
if (configPromise) {
|
||||
return configPromise;
|
||||
return configPromise
|
||||
}
|
||||
configPromise = fetch('/api/config')
|
||||
.then((res) => res.json())
|
||||
.then((data: SystemConfig) => {
|
||||
cachedConfig = data;
|
||||
return data;
|
||||
cachedConfig = data
|
||||
return data
|
||||
})
|
||||
.finally(() => {
|
||||
// Keep cachedConfig for reuse; allow re-fetch via explicit invalidation if added later
|
||||
});
|
||||
return configPromise;
|
||||
})
|
||||
return configPromise
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user