Files
AstralRinth/packages/api-client/src/features/panel-version.ts
2025-12-04 15:15:03 +01:00

19 lines
479 B
TypeScript

import { AbstractFeature } from '../core/abstract-feature'
import type { RequestContext } from '../types/request'
export const PANEL_VERSION = 1
export class PanelVersionFeature extends AbstractFeature {
async execute<T>(next: () => Promise<T>, context: RequestContext): Promise<T> {
context.options.headers = {
...context.options.headers,
'X-Panel-Version': String(PANEL_VERSION),
}
return next()
}
shouldApply(_: RequestContext): boolean {
return true
}
}