16 lines
495 B
TypeScript
16 lines
495 B
TypeScript
import { SourceType } from '@/app/types'
|
||
|
||
const pathToSourceMap: Record<string, SourceType> = {
|
||
techSupport: 'contact-us', // берем в кавычки значение с дефисом
|
||
account: 'account',
|
||
}
|
||
|
||
export const getSourceFromPath = (pathname: string): SourceType => {
|
||
const cleanPath = pathname.replace(/^\//, '')
|
||
|
||
const source = pathToSourceMap[cleanPath] || 'contact-us' // дефолтное значение
|
||
// console.log('Final source:', source)
|
||
|
||
return source
|
||
}
|