Skip to content

Commit

Permalink
docs: LDCL-54: Add jsdocs for provided API helpers (#222)
Browse files Browse the repository at this point in the history
* fix: LDCL-54: Modify getDrupalBaseUrl to always return general base url

* LDCL-54: Revert

* LDCL-54: Add docs for helpers

* LDCL-54: Add jsdocs
  • Loading branch information
vloss3 authored Apr 15, 2024
1 parent a55a2cc commit 0e9c3e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/runtime/composables/useDrupalCe/server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { useRuntimeConfig } from '#imports'

/**
* Returns the drupalBaseUrl.
* On server it returns the serverDrupalBaseUrl if set, otherwise it returns the drupalBaseUrl.
*
* @returns {string}
*/
export const getDrupalBaseUrl = () => {
const config = useRuntimeConfig().public.drupalCe
return import.meta.server && config.serverDrupalBaseUrl ? config.serverDrupalBaseUrl : config.drupalBaseUrl
}

/**
* Returns the menuBaseUrl if set, otherwise it returns the drupalBaseUrl + ceApiEndpoint.
*
* @returns {string}
*/
export const getMenuBaseUrl = () => {
const config = useRuntimeConfig().public.drupalCe
return config.menuBaseUrl ? config.menuBaseUrl : getDrupalBaseUrl() + config.ceApiEndpoint
Expand Down

0 comments on commit 0e9c3e8

Please sign in to comment.