fix. formatPathHost 파라미터 직관적으로 명칭 수정
This commit is contained in:
@@ -52,7 +52,7 @@ export const formatPathWithoutLocale = (path: string): string => {
|
||||
*/
|
||||
export const formatPathHost = (
|
||||
path: string,
|
||||
options: { imageType?: 'common' | 'game'; isSkipHost?: boolean } = {}
|
||||
options: { imageType?: 'public' | 'cdn'; isSkipHost?: boolean } = {}
|
||||
): string => {
|
||||
if (!path) return ''
|
||||
|
||||
@@ -60,18 +60,18 @@ export const formatPathHost = (
|
||||
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const { staticUrl, assetsUrl } = runtimeConfig.public
|
||||
const { imageType = 'game', isSkipHost = false } = options
|
||||
const { imageType = 'cdn', isSkipHost = false } = options
|
||||
|
||||
const isDevelopment = import.meta.dev
|
||||
const isTypeGame = imageType === 'game'
|
||||
const isTypeCdn = imageType === 'cdn'
|
||||
|
||||
if (isSkipHost) return path
|
||||
|
||||
// 개발 환경일 때는 루트 경로 생략
|
||||
if (!isTypeGame && isDevelopment) return path
|
||||
if (!isTypeCdn && isDevelopment) return path
|
||||
|
||||
// 게임/공통 여부에 따른 경로 결정
|
||||
const basePath = isTypeGame ? staticUrl : assetsUrl
|
||||
const basePath = isTypeCdn ? staticUrl : assetsUrl
|
||||
|
||||
return `${basePath}${path}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user