finished reset password & other changes
This commit is contained in:
14
lib/utils.ts
14
lib/utils.ts
@@ -1,6 +1,6 @@
|
||||
import { type ClassValue, clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import { LC } from '@/config/locales'
|
||||
import { LC, locales } from '@/config/locales'
|
||||
|
||||
import { env as dotEnv } from 'process'
|
||||
|
||||
@@ -16,6 +16,14 @@ export function env (variable: string, defaultValue?: string | ''): string {
|
||||
return (dotEnv[variable] ?? defaultValue ?? '')
|
||||
}
|
||||
|
||||
export function tr (el: React.ReactNode, params: object) {
|
||||
export const testPathnameRegex = (
|
||||
pages: string[], pathName: string): boolean => {
|
||||
const pattern: string = `^(/(${locales.join('|')}))?(${pages.flatMap(
|
||||
(p) => (p === '/' ? ['', '/'] : p)).join('|')})/?$`
|
||||
|
||||
//console.log(pattern)
|
||||
|
||||
return RegExp(pattern, 'is').test(pathName)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user