diff --git a/frontend/.env-example b/frontend/.env-example index 521652760..ffb100613 100644 --- a/frontend/.env-example +++ b/frontend/.env-example @@ -1,3 +1,4 @@ +NUXT_IS_API_MOCKED= NUXT_PRIVATE_API_SERVER= NUXT_PRIVATE_LEGACY_API_SERVER= NUXT_PUBLIC_API_CLIENT= diff --git a/frontend/README.md b/frontend/README.md index 678f9fb89..190640f2a 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -122,6 +122,14 @@ bun run preview Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. +## Get mocked api data + +If your `user` was added to the `ADMIN` or `DEV` group by the `api team`, you can get +`mocked data` from the `api` for certain `endpoints` by adding `?is_mocked=true` as a +`query parameter`. + +You can `turn on` mocked data `globally` for all `configured enpoints` by setting `NUXT_PUBLIC_IS_API_MOCKED=true`. + ## Descision Record We documented our decisions in the [decisions](decisions.md) file. diff --git a/frontend/composables/useCustomFetch.ts b/frontend/composables/useCustomFetch.ts index c44ad29ba..8607af8a8 100644 --- a/frontend/composables/useCustomFetch.ts +++ b/frontend/composables/useCustomFetch.ts @@ -85,6 +85,7 @@ export function useCustomFetch() { options.query = { ...options.query, ...query, + is_mocked: true, } options.credentials = 'include' const method = options.method || map.method || 'GET' diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index 174e10fd1..2569ea263 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -89,6 +89,7 @@ export default defineNuxtConfig({ deploymentType: process.env.PUBLIC_DEPLOYMENT_TYPE, domain: process.env.PUBLIC_DOMAIN, gitVersion, + isApiMocked: '', legacyApiClient: process.env.PUBLIC_LEGACY_API_CLIENT, logFile: '', logIp: '', diff --git a/frontend/types/datatable.ts b/frontend/types/datatable.ts index e8477da55..4c4c1e56d 100644 --- a/frontend/types/datatable.ts +++ b/frontend/types/datatable.ts @@ -4,7 +4,7 @@ export type SortOrder = -1 | 0 | 1 | null | undefined export type TableQueryParams = { cursor?: Cursor, - isMocked?: boolean, + is_mocked?: boolean, limit?: number, order?: ColumnOrder, search?: string,