Compare commits
2 Commits
d6270e6f47
...
0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3aceb48057 | ||
| eac315bea1 |
@@ -44,3 +44,8 @@
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* FRO-29 Websocket Communication ([#7](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/7)) ([64d528b](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/64d528bf5c8b5d4f0d31274d600b3f05b8c47740))
|
* FRO-29 Websocket Communication ([#7](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/7)) ([64d528b](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/64d528bf5c8b5d4f0d31274d600b3f05b8c47740))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/compare/0.2.1...0.0.0) (2025-12-10)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* FRO-2 Implement Login Component ([#8](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/issues/8)) ([eac315b](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/commit/eac315bea1a2075858648bbc49c200b8020e1ff7))
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'quasar/dist/quasar.css'
|
|||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios'
|
||||||
|
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
@@ -33,6 +34,8 @@ axios.interceptors.response.use(
|
|||||||
res => res,
|
res => res,
|
||||||
err => {
|
err => {
|
||||||
if (err.response?.status === 401) {
|
if (err.response?.status === 401) {
|
||||||
|
const info = useUserInfo();
|
||||||
|
info.clearUserInfo();
|
||||||
router.replace({name: 'login'});
|
router.replace({name: 'login'});
|
||||||
}
|
}
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
);
|
);
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
info.clearUserInfo();
|
||||||
next('/login');
|
next('/login');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,3 +45,5 @@ type WonInfo = {
|
|||||||
winner: PodiumPlayer | null
|
winner: PodiumPlayer | null
|
||||||
allPlayers: PodiumPlayer[]
|
allPlayers: PodiumPlayer[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type { GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo }
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import { useQuasar } from 'quasar'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
import {useUserInfo} from "@/composables/useUserInfo.ts";
|
||||||
|
|
||||||
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
||||||
|
|
||||||
@@ -71,12 +72,14 @@ const username = ref(null)
|
|||||||
const password = ref(null)
|
const password = ref(null)
|
||||||
const inProgress = ref(false)
|
const inProgress = ref(false)
|
||||||
const loginError = ref('')
|
const loginError = ref('')
|
||||||
|
const uInfo = useUserInfo()
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
if (inProgress.value) return
|
if (inProgress.value) return
|
||||||
inProgress.value = true
|
inProgress.value = true
|
||||||
loginError.value = ''
|
loginError.value = ''
|
||||||
axios.post(`${api}/login`, {username: username.value, password: password.value}, {withCredentials: true}).then(response => {
|
axios.post(`${api}/login`, {username: username.value, password: password.value}, {withCredentials: true}).then((response) => {
|
||||||
|
uInfo.setUserInfo(response.data.user.username, response.data.user.id)
|
||||||
router.push("/")
|
router.push("/")
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
loginError.value = 'Invalid username or password'
|
loginError.value = 'Invalid username or password'
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=2
|
MINOR=3
|
||||||
PATCH=1
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user