Source

services/search-service.js

import { getEventsSearchSelectionLimit as gessl } from '@/services/events-service.js'

export const getEventsSearchSelectionLimit = gessl

/**
 * @namespace Services
 * @category Services
 * @module search-service
 * */

import store from '@/store'

export default {
  waitUntilInitialized,
}

/**
 * Wait until store.state.search_module.initialized is true
 * @param {boolean} type Optionally wait for reference data to be available (vehicles/drivers/circuits)
 */
export async function waitUntilInitialized(type = '') {
  return new Promise((resolve, reject) => {
    wait()
    function wait() {
      const isTypeInitialized =
        type === '' ||
        store.getters['search_module/isInitialLoadingComplete'][type] === true

      if (store.state.search_module.initialized && isTypeInitialized) {
        resolve()
      } else {
        setTimeout(wait, 50)
      }
    }
  })
}

export function getIdentificationSearchSelectionLimit() {
  return (
    parseFloat(
      process.env.VUE_APP_IDENTIFICATION_MODULE_SEARCH_SELECTION_LIMIT ||
        process.env.VUE_APP_SEARCH_SELECTION_LIMIT
    ) || 50
  )
}

export function getLocationSearchSelectionLimit() {
  return parseFloat(process.env.VUE_APP_SEARCH_SELECTION_LIMIT) || 120
}