From fd1cd3d88ad9dd4482cc95ada3cf03fc9fee8780 Mon Sep 17 00:00:00 2001 From: TuuKeZu Date: Fri, 16 Aug 2024 16:20:06 +0300 Subject: [PATCH] use config.json instead of .env --- package.json | 4 ++-- src/compontents/Login/Login.js | 4 ++-- src/features/authentication/authSlice.js | 6 ++---- src/features/themes/themeSlice.js | 1 - src/requests/theme-api.js | 5 ++--- src/requests/wilma-api.js | 4 ++-- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index ac3688d..7379207 100644 --- a/package.json +++ b/package.json @@ -67,9 +67,9 @@ "workbox-webpack-plugin": "^6.4.1" }, "scripts": { - "start": "node --env-file=.env scripts/start.js", + "start": "node scripts/start.js", "build": "node scripts/build.js", - "test": "node --env-file=.env scripts/test.js" + "test": "node scripts/test.js" }, "eslintConfig": { "extends": "react-app" diff --git a/src/compontents/Login/Login.js b/src/compontents/Login/Login.js index 74e02a1..1777320 100644 --- a/src/compontents/Login/Login.js +++ b/src/compontents/Login/Login.js @@ -15,8 +15,8 @@ import { useNavigate } from 'react-router-dom'; import { BlurLayer } from '../LoadingScreen/LoadingScreen'; import { useVersion } from '../../features/version/versionSlice'; -const { REACT_APP_VERSION_LABEL } = process.env; -const versionLabel = REACT_APP_VERSION_LABEL; +import config from '../../config.json'; +const { versionLabel } = config; export default function Login() { diff --git a/src/features/authentication/authSlice.js b/src/features/authentication/authSlice.js index 108797d..29d1208 100644 --- a/src/features/authentication/authSlice.js +++ b/src/features/authentication/authSlice.js @@ -8,8 +8,8 @@ import { import { handleError } from '../errors/errorSlice'; import crypto from 'crypto-js'; -const { REACT_APP_SIGNATURE } = process.env; -const signature = REACT_APP_SIGNATURE; +import config from '../../config.json'; +const { signature } = config; export const loginToWilma = createAsyncThunk( 'auth/loginToWilma', @@ -84,8 +84,6 @@ export const getSavedCredentials = () => { } if (encrypted === "null") return null; - - console.log(encrypted); const decrypted = crypto.AES.decrypt(encrypted, signature).toString(crypto.enc.Utf8); try { diff --git a/src/features/themes/themeSlice.js b/src/features/themes/themeSlice.js index 920dc3d..9bc4ace 100644 --- a/src/features/themes/themeSlice.js +++ b/src/features/themes/themeSlice.js @@ -56,7 +56,6 @@ export const loadThemeDefault = createAsyncThunk( 'themes/loadThemeDefault', async (options, thunkAPI) => { return await new Promise((resolve, reject) => { - console.log(process.env); const themes = thunkAPI.getState().themes; const id = options['id']; diff --git a/src/requests/theme-api.js b/src/requests/theme-api.js index 5551405..4c60faa 100644 --- a/src/requests/theme-api.js +++ b/src/requests/theme-api.js @@ -5,9 +5,8 @@ import { cacheAvailable } from './utility' -const { REACT_APP_OTAWILMA_API } = process.env; -const otaWilmaApi = REACT_APP_OTAWILMA_API; - +import config from '../config.json'; +const { otaWilmaApi } = config; const login = (auth) => { return new Promise(async (resolve, reject) => { diff --git a/src/requests/wilma-api.js b/src/requests/wilma-api.js index fa178e5..53d2efd 100644 --- a/src/requests/wilma-api.js +++ b/src/requests/wilma-api.js @@ -8,8 +8,8 @@ import { import { login as loginToOtaWilma } from './theme-api' -const { REACT_APP_WILMA_API } = process.env; -const wilmaApi = REACT_APP_WILMA_API; +import config from '../config.json'; +const { wilmaApi } = config; const login = (credentials) => { return new Promise((resolve, reject) => {