From 5860d254f43acb743fa4313aeb4f12d9140b4645 Mon Sep 17 00:00:00 2001 From: Karl Anthony Baluyot Date: Thu, 9 Apr 2020 21:34:11 +0800 Subject: [PATCH] fix env and add example --- .env.example | 4 ---- .gitignore | 1 - app/repository/api.config.ts | 2 +- types/env.d.ts | 1 + webpack.config.js | 1 + 5 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index b8bee57..0000000 --- a/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -APP_TITLE='Lyduz | Free Stock Trading Platform' -APP_URL=http://localhost:6969 -API_URL=https://dev-api.lyduz.com/api -API_URL_BROWSER=https://dev-api.lyduz.com/api \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5e6f432..72ca799 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,4 @@ hooks platforms # Root Variables -.env **/.DS_Store \ No newline at end of file diff --git a/app/repository/api.config.ts b/app/repository/api.config.ts index ebfaf17..b6d4a53 100644 --- a/app/repository/api.config.ts +++ b/app/repository/api.config.ts @@ -1,7 +1,7 @@ import qs from 'qs' export const Config = { - baseURL: 'https://jsonplaceholder.typicode.com', + baseURL: TNS_API_URL, headers: { common: { 'Content-Type': 'application/json', diff --git a/types/env.d.ts b/types/env.d.ts index 03c57fa..817efaf 100644 --- a/types/env.d.ts +++ b/types/env.d.ts @@ -1 +1,2 @@ declare var TNS_ENV: string +declare var TNS_API_URL: string \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 1633911..32a9b82 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -282,6 +282,7 @@ module.exports = env => { new webpack.DefinePlugin({ "global.TNS_WEBPACK": "true", "TNS_ENV": JSON.stringify(mode), + "TNS_API_URL": (mode === "production") ? JSON.stringify("https://jsonplaceholder.typicode.com") : JSON.stringify("https://jsonplaceholder.typicode.com"), "process": "global.process" }), // Remove all files from the out dir.