22 lines
653 B
TypeScript
22 lines
653 B
TypeScript
const API_AUTH_FREE_PATHS = [
|
|
'/user/send-verification-code',
|
|
'/user/phone-login',
|
|
'/user/check/login-shops/phone/',
|
|
'/legal-agreement/current'
|
|
]
|
|
|
|
const ADMIN_AUTH_FREE_PATHS = [
|
|
'/auth/login',
|
|
'/auth/login-shops/',
|
|
'/auth/refresh'
|
|
]
|
|
|
|
const matchPath = (url: string | undefined, paths: string[]): boolean => {
|
|
const target = String(url || '')
|
|
return paths.some(path => target === path || target.startsWith(path))
|
|
}
|
|
|
|
export const isApiAuthFreePath = (url: string | undefined): boolean => matchPath(url, API_AUTH_FREE_PATHS)
|
|
|
|
export const isAdminAuthFreePath = (url: string | undefined): boolean => matchPath(url, ADMIN_AUTH_FREE_PATHS)
|