diff --git a/.env b/.env
index 7a60ec8..cffd798 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,3 @@
VITE_API_URL="https://stacjownik.spythere.pl"
VITE_API_URL_DEV="http://localhost:3001"
-VITE_API_DEV=0
\ No newline at end of file
+VITE_API_DEV=1
\ No newline at end of file
diff --git a/public/favicon.svg b/public/favicon.svg
index 02a2a80..e8bca20 100644
--- a/public/favicon.svg
+++ b/public/favicon.svg
@@ -1,51 +1,51 @@
-
+
diff --git a/public/icon-logo.svg b/public/icon-logo.svg
index 02a2a80..e8bca20 100644
--- a/public/icon-logo.svg
+++ b/public/icon-logo.svg
@@ -1,51 +1,51 @@
-
+
diff --git a/public/icon-trash.svg b/public/icon-trash.svg
index 109b923..e51347a 100644
--- a/public/icon-trash.svg
+++ b/public/icon-trash.svg
@@ -1,7 +1,7 @@
-
+
diff --git a/src/App.vue b/src/App.vue
index 9561639..691c3ac 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -10,8 +10,9 @@ import PopUpCard from './components/PopUpCard.vue';
import { RouterView } from 'vue-router';
import { AuthState } from './types/types';
import useRouteGuard from './mixins/useRouteGuard';
-import { useStore } from './store';
+import { baseURL, useStore } from './store';
import useLocalStorage from './mixins/useLocalStorage';
+import axios from 'axios';
export default defineComponent({
components: { PopUpCard },
@@ -20,7 +21,7 @@ export default defineComponent({
const { routeAuthGuard } = useRouteGuard();
const { setupStorage } = useLocalStorage();
- routeAuthGuard();
+ // routeAuthGuard();
setupStorage();
return {
@@ -30,28 +31,21 @@ export default defineComponent({
methods: {
async autoLogin() {
- const token = window.localStorage.getItem('auth-token');
- if (!token) {
- this.store.authState = AuthState.UNAUTHORIZED;
- return;
+ try {
+ const response = await axios.post(
+ '/auth/token',
+ {},
+ {
+ baseURL,
+ withCredentials: true,
+ }
+ );
+
+ this.store.user = response.data;
+ this.$router.push('/');
+ } catch (error) {
+ this.$router.push('/login');
}
-
- this.store.token = token;
-
- this.store
- .fetchTokenData()
- .then((res) => {
- this.store.user = res.data.user;
- this.store.authState = AuthState.AUTHORIZED;
- this.$router.push('/');
- })
- .catch((err) => {
- this.store.isAuthorized = false;
- window.localStorage.removeItem('auth-token');
-
- this.store.authState = AuthState.UNAUTHORIZED;
- this.$router.push('/login');
- });
},
},
diff --git a/src/components/ChangesModal.vue b/src/components/ChangesModal.vue
index 46208e7..db9cd9b 100644
--- a/src/components/ChangesModal.vue
+++ b/src/components/ChangesModal.vue
@@ -1,54 +1,54 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/components/PopUpCard.vue b/src/components/PopUpCard.vue
index 09769da..c90ec98 100644
--- a/src/components/PopUpCard.vue
+++ b/src/components/PopUpCard.vue
@@ -1,68 +1,68 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/components/TableActions.vue b/src/components/TableActions.vue
index 88a447d..0340c64 100644
--- a/src/components/TableActions.vue
+++ b/src/components/TableActions.vue
@@ -82,9 +82,10 @@