diff --git a/lib/api.js b/lib/api.js index f9920ef..9115323 100644 --- a/lib/api.js +++ b/lib/api.js @@ -2,10 +2,11 @@ import axios from 'axios' import debounce from 'lodash.debounce' import ms from 'ms' -import getConfig from 'next/config' -const { publicRuntimeConfig } = getConfig() - -const client = axios.create({ baseURL: publicRuntimeConfig.API_URL }) +const client = axios.create({ + baseURL: `${ + process.env.API_URL || process.env.NODE_ENV === 'production' ? '' : 'http://localhost:4000' + }/api` +}) const RATE_LIMIT_CODE = 420 diff --git a/next.config.js b/next.config.js index 408e07d..121770d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,2 @@ // const { PHASE_DEVELOPMENT_SERVER } = require('next/constants') // const withOffline = require('next-offline') - -module.exports = { - publicRuntimeConfig: { - API_URL: process.env.API_URL || 'http://localhost:4000' - } -}