mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-22 09:23:16 +01:00
Matthias Kretschmann
dd44cc864e
* new prices data structure * market data refactor, add 24h price change * browser language detection with middleware * middleware tweaks
12 lines
346 B
TypeScript
12 lines
346 B
TypeScript
import { NextResponse, type NextRequest } from 'next/server'
|
|
|
|
export function middleware(request: NextRequest) {
|
|
// add x-locale header to all responses
|
|
const locale =
|
|
request.headers.get('accept-language')?.split(',')?.[0] || 'en-US'
|
|
const response = NextResponse.next()
|
|
response.headers.set('x-locale', locale)
|
|
|
|
return response
|
|
}
|