Files
kspguti-schedule/old/data/groups.ts
kilyabin 56a48b4552 fix: database location
Founded a major mistake: db overwrites during install.  Now all scripts save db in special folder and don't overwrite it.
2025-12-04 23:44:21 +04:00

19 lines
797 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Загружаем группы из JSON файла только на сервере
// На клиенте будет пустой объект, группы должны передаваться через props
let groups: { [group: string]: [number, string] } = {}
// Используем условный require только на сервере для избежания включения fs в клиентскую сборку
if (typeof window === 'undefined') {
// Серверная сторона
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const groupsLoader = require('./groups-loader')
groups = groupsLoader.loadGroups()
} catch (error) {
console.error('Error loading groups:', error)
groups = {}
}
}
export { groups }