1 Commits

Author SHA1 Message Date
d6270e6f47 feat: FRO-2 Implement Login Component 2025-12-10 11:25:57 +01:00
6 changed files with 3 additions and 17 deletions

View File

@@ -44,8 +44,3 @@
### 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))

View File

@@ -11,7 +11,6 @@ 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()
@@ -34,8 +33,6 @@ 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);

View File

@@ -49,7 +49,6 @@ router.beforeEach(async (to, from, next) => {
); );
next(); next();
} catch (err) { } catch (err) {
info.clearUserInfo();
next('/login'); next('/login');
} }
}); });

View File

@@ -45,5 +45,3 @@ type WonInfo = {
winner: PodiumPlayer | null winner: PodiumPlayer | null
allPlayers: PodiumPlayer[] allPlayers: PodiumPlayer[]
} }
export type { GameInfo, LobbyInfo, TieInfo, TrumpInfo, WonInfo }

View File

@@ -62,7 +62,6 @@ 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;
@@ -72,14 +71,12 @@ 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'

View File

@@ -1,3 +1,3 @@
MAJOR=0 MAJOR=0
MINOR=3 MINOR=2
PATCH=0 PATCH=1