From 6d4d6077af369d08e38e2efd66e2cb9845e3919d Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 29 Nov 2023 14:22:58 +0100 Subject: [PATCH] =?UTF-8?q?zmiana=20endpoint=C3=B3w;=20poprawki=20designu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +-- src/App.vue | 17 +++-------- src/common/http.ts | 8 ++++++ src/components/TableActions.vue | 46 ++++++++---------------------- src/store.ts | 50 +++++++++++++-------------------- src/views/LoginView.vue | 21 ++++++-------- src/views/ManagerView.vue | 19 ++++++------- 7 files changed, 62 insertions(+), 103 deletions(-) create mode 100644 src/common/http.ts diff --git a/.env b/.env index 8e63cd4..1ea1c62 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -VITE_API_URL="https://stacjownik.spythere.pl" +VITE_API_URL="https://stacjownik.spythere.eu" VITE_API_URL_DEV="http://localhost:3001" -VITE_API_DEV="0" \ No newline at end of file +VITE_API_DEV=0 \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 7631ad5..196ab80 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,11 +8,10 @@ import { defineComponent } from 'vue'; import PopUpCard from './components/PopUpCard.vue'; import { RouterView } from 'vue-router'; -import { AuthState } from './types/types'; -import { baseURL, useStore } from './store'; +import { useStore } from './store'; import useLocalStorage from './mixins/useLocalStorage'; -import axios from 'axios'; import { IUser } from './types/types'; +import client from './common/http'; export default defineComponent({ components: { PopUpCard }, @@ -33,14 +32,7 @@ export default defineComponent({ try { this.tokenLoading = true; - const response = await axios.post( - '/auth/token', - {}, - { - baseURL, - withCredentials: true, - } - ); + const response = await client.post('/auth/token'); this.store.setUserData(response.data); this.$router.push('/'); @@ -96,7 +88,7 @@ button { outline: none; border: none; - background-color: #000000; + background-color: #0066ff; color: white; padding: 0.5rem 0.75rem; @@ -164,4 +156,3 @@ button { background: #aaa; } - diff --git a/src/common/http.ts b/src/common/http.ts new file mode 100644 index 0000000..07b851b --- /dev/null +++ b/src/common/http.ts @@ -0,0 +1,8 @@ +import axios from 'axios'; + +const client = axios.create({ + baseURL: import.meta.env['VITE_API_URL'], + withCredentials: true, +}); + +export default client; diff --git a/src/components/TableActions.vue b/src/components/TableActions.vue index 878ad00..c996d57 100644 --- a/src/components/TableActions.vue +++ b/src/components/TableActions.vue @@ -21,19 +21,13 @@   - +
- +
@@ -66,9 +53,7 @@
- +
@@ -82,10 +67,11 @@