Skip to content

Commit

Permalink
fix(*): logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewhchen committed Mar 12, 2024
1 parent d89b248 commit 4aca2c1
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default function useFetchUrlBuilder(
const _config = ref(unref(config))
const _baseUrl = ref(unref(baseUrl))

const isExactMatch = computed((): boolean => !!_config.value.isExactMatch)
const isExactMatch = computed(
(): boolean => !!(_config.value.app === 'konnect' || _config.value.isExactMatch),
)
// const isExactMatch = computed((): boolean => !!_config.value.isExactMatch)

// Construct a URL object, adding the current `window.location.origin` if the path begins with a slash
const baseRequestUrl = computed((): URL =>
Expand All @@ -31,13 +34,10 @@ export default function useFetchUrlBuilder(
try {
let urlWithParams: URL = new URL(baseRequestUrl.value.href)
if (isExactMatch.value && query) {
// Using exact match
urlWithParams.search = '' // trim any query params
urlWithParams = new URL(`${urlWithParams.href}/${query}/`)
} else if (_config.value.app === 'konnect') {
// Konnect support filter param structure
urlWithParams.search = '' // trim any query params
urlWithParams = new URL(`${urlWithParams.href}?filter[name][contains]=${query}`)
urlWithParams = _config.value.isExactMatch
? new URL(`${urlWithParams.href}/${query}/`)
: new URL(`${urlWithParams.href}?filter[name][contains]=${query}`)
} else {
if (!isExactMatch.value) {
// Using fuzzy match
Expand Down

0 comments on commit 4aca2c1

Please sign in to comment.