Skip to content

Commit 8b35512

Browse files
authored
TEMP: Revert back to publicRuntime config (#2082)
* TEMP: Revert back to publicRuntime config * chore: Fix campaign application test * fix: Setup correct env in next config
1 parent 26917d2 commit 8b35512

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const moduleExports = {
3232
},
3333
publicRuntimeConfig: {
3434
APP_ENV: process.env.APP_ENV,
35-
API_URL: process.env.NEXT_PUBLIC_API_URL,
35+
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
3636
APP_URL: process.env.APP_URL,
3737
GTM_ID: process.env.GTM_ID ?? 'GTM-TWQBXM6',
3838
PAYPAL_CLIENT_ID: process.env.PAYPAL_CLIENT_ID,

src/service/apiClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import Axios from 'axios'
22
import LRU from 'lru-cache'
33
import { makeUseAxios } from 'axios-hooks'
4+
import getConfig from 'next/config'
45

5-
export const API_URL = process.env.NEXT_PUBLIC_API_URL
6+
const {
7+
publicRuntimeConfig: { NEXT_PUBLIC_API_URL },
8+
} = getConfig()
9+
10+
export const API_URL = NEXT_PUBLIC_API_URL
611

712
const cache = new LRU({ max: 10 })
813
export const apiClient = Axios.create({ baseURL: `${API_URL}` })

src/test/setupTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jest.mock('next-i18next', () => ({
2121
}))
2222

2323
jest.mock('next/config', () => () => ({
24-
publicRuntimeConfig: { API_URL: 'http://localhost/api', APP_URL: 'http://localhost' },
24+
publicRuntimeConfig: { NEXT_PUBLIC_API_URL: 'http://localhost/api', APP_URL: 'http://localhost' },
2525
}))

0 commit comments

Comments
 (0)