Add react-env to try to get it to work
This commit is contained in:
parent
9305a8bd20
commit
6b39168be2
3 changed files with 18 additions and 8 deletions
11
package-lock.json
generated
11
package-lock.json
generated
|
|
@ -19,6 +19,7 @@
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
"react-env": "^0.0.0",
|
||||||
"react-i18next": "^11.15.3",
|
"react-i18next": "^11.15.3",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
"sass": "^1.49.0"
|
"sass": "^1.49.0"
|
||||||
|
|
@ -5811,6 +5812,11 @@
|
||||||
"react": "17.0.2"
|
"react": "17.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-env": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-env/-/react-env-0.0.0.tgz",
|
||||||
|
"integrity": "sha1-+p8K+Y1VWwsPYO3Mrg1juj67rVE="
|
||||||
|
},
|
||||||
"node_modules/react-i18next": {
|
"node_modules/react-i18next": {
|
||||||
"version": "11.15.3",
|
"version": "11.15.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
|
||||||
|
|
@ -10852,6 +10858,11 @@
|
||||||
"scheduler": "^0.20.2"
|
"scheduler": "^0.20.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"react-env": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-env/-/react-env-0.0.0.tgz",
|
||||||
|
"integrity": "sha1-+p8K+Y1VWwsPYO3Mrg1juj67rVE="
|
||||||
|
},
|
||||||
"react-i18next": {
|
"react-i18next": {
|
||||||
"version": "11.15.3",
|
"version": "11.15.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "grid-web",
|
"name": "grid-web",
|
||||||
"private": true,
|
"private": true,
|
||||||
"cacheDirectories": [".next/cache"],
|
"cacheDirectories": [
|
||||||
|
".next/cache"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 1234",
|
"dev": "next dev -p 1234",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
|
|
@ -22,6 +24,7 @@
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
"react-env": "^0.0.0",
|
||||||
"react-i18next": "^11.15.3",
|
"react-i18next": "^11.15.3",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.2.1",
|
||||||
"sass": "^1.49.0"
|
"sass": "^1.49.0"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import axios, { AxiosRequestConfig, AxiosResponse } from "axios"
|
import axios, { AxiosRequestConfig, AxiosResponse } from "axios"
|
||||||
|
import { env } from 'react-env'
|
||||||
|
|
||||||
interface Entity {
|
interface Entity {
|
||||||
name: string
|
name: string
|
||||||
|
|
@ -23,9 +24,6 @@ class Api {
|
||||||
constructor({url}: {url: string}) {
|
constructor({url}: {url: string}) {
|
||||||
this.url = url
|
this.url = url
|
||||||
this.endpoints = {}
|
this.endpoints = {}
|
||||||
|
|
||||||
console.log(`api url ${process.env.REACT_APP_SIERO_API_URL}`)
|
|
||||||
console.log(`siero url ${process.env.REACT_APP_SIERO_OAUTH_URL}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createEntity(entity: Entity) {
|
createEntity(entity: Entity) {
|
||||||
|
|
@ -49,8 +47,7 @@ class Api {
|
||||||
}
|
}
|
||||||
|
|
||||||
login(object: {}) {
|
login(object: {}) {
|
||||||
const oauthUrl = (process.env.REACT_APP_SIERO_OAUTH_URL) ? process.env.REACT_APP_SIERO_OAUTH_URL : 'http://127.0.0.1:3000/oauth'
|
return axios.post(`${ env("REACT_APP_SIERO_OAUTH_URL") }/token`, object)
|
||||||
return axios.post(`${ oauthUrl }/token`, object)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
search(object: string, query: string, excludes: string) {
|
search(object: string, query: string, excludes: string) {
|
||||||
|
|
@ -69,8 +66,7 @@ class Api {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiUrl = (process.env.REACT_APP_SIERO_API_URL) ? process.env.REACT_APP_SIERO_API_URL : 'http://127.0.0.1:3000/api/v1'
|
const api: Api = new Api({ url: env("REACT_APP_SIERO_API_URL") })
|
||||||
const api: Api = new Api({ url: apiUrl })
|
|
||||||
api.createEntity( { name: 'users' })
|
api.createEntity( { name: 'users' })
|
||||||
api.createEntity( { name: 'parties' })
|
api.createEntity( { name: 'parties' })
|
||||||
api.createEntity( { name: 'characters' })
|
api.createEntity( { name: 'characters' })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue