diff --git a/README.md b/README.md index fd45e19..0f7abd0 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ npm install ### Compiles and hot-reloads for development ``` -npm run serve +VUE_APP_API_URL=localhost:8000 npm run serve ``` ### Compiles and minifies for production ``` -npm run build +VUE_APP_API_URL=localhost:8000 npm run build ``` ### Lints and fixes files @@ -25,4 +25,7 @@ npm run lint ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). -Vorraussetzung: Node & NPM \ No newline at end of file +Vorraussetzung: Node & NPM + +### Enviroment Variable +VUE_APP_API_URL ist die Enviroment Variable mit der die Adresse der API übergeben wird \ No newline at end of file diff --git a/src/views/Index.vue b/src/views/Index.vue index a513617..670d4c6 100644 --- a/src/views/Index.vue +++ b/src/views/Index.vue @@ -26,6 +26,7 @@ + Globales WTF Passwort zurücksetzen @@ -40,12 +41,19 @@ import axios from 'axios' export default { name: "Index", + data(){ + return { + showErrorMessage: false, + email: '', + password: '' + } + }, methods: { async submitLogin(){ this.showErrorMessage = false try{ const loginResult = await axios.post( - `${this.apiUrl}/login`, + `${process.env.VUE_APP_API_URL}/users/login`, { email: this.email, password: this.password @@ -63,13 +71,6 @@ export default { } } - }, - data(){ - return { - showErrorMessage: false, - email: '', - password: '' - } } } \ No newline at end of file diff --git a/src/views/Search.vue b/src/views/Search.vue index 13f434a..95d24ad 100644 --- a/src/views/Search.vue +++ b/src/views/Search.vue @@ -36,14 +36,14 @@ export default { this.showErrorMessage = false try{ const loginResult = await axios.post( - `${this.apiUrl}/search`, + `${process.env.VUE_APP_API_URL}/search`, // Beispiel Hafte Daten { searchText: this.searchText, }) if(loginResult.status === 200){ //success login - router.push({path: 's/search'}) + this.router.push({path: 's/search'}) } else{ this.showErrorMessage = true diff --git a/src/views/profile/Edit.vue b/src/views/profile/Edit.vue index 25e6480..b5b58a8 100644 --- a/src/views/profile/Edit.vue +++ b/src/views/profile/Edit.vue @@ -1,11 +1,69 @@ \ No newline at end of file