Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
feat: add back url as env var
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Feb 15, 2019
1 parent b736594 commit 4c4caac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions front/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ module.exports = withPlugins(
cssModules: true,
},
],
{
publicRuntimeConfig: {
backUrl: process.env.BACK_URL || 'http://localhost:3000',
},
},
],
{
webpack(config, options) {
Expand Down
6 changes: 5 additions & 1 deletion front/src/domain/api/Api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import axios, { AxiosInstance } from 'axios'
import getConfig from 'next/config'
import { Option } from 'tsoption'

const { publicRuntimeConfig } = getConfig()
const { backUrl } = publicRuntimeConfig

export class Api {
public get client() {
return this.axios
Expand All @@ -14,7 +18,7 @@ export class Api {
: {}

this.axios = axios.create({
baseURL: 'http://localhost:3000/',
baseURL: backUrl,
headers: authHeaders,
})
}
Expand Down

0 comments on commit 4c4caac

Please sign in to comment.