app progress

This commit is contained in:
Sascha Kühl 2025-04-21 21:48:46 +02:00
parent c40c931209
commit 05ead54051
6 changed files with 4 additions and 12 deletions

View File

@ -2,6 +2,8 @@ import axios from "axios";
const server = JSON.parse(localStorage.getItem("server") || '""'); const server = JSON.parse(localStorage.getItem("server") || '""');
const host = `${server.protocol}://${server.host}:${server.port}/api`;
const instance = axios.create({ const instance = axios.create({
baseURL: `${server.protocol}://${server.host}:${server.port}/api`, baseURL: `${server.protocol}://${server.host}:${server.port}/api`,
headers: { headers: {

View File

@ -5,7 +5,7 @@ class BackendService {
return localStorage.getItem("server") !== null; return localStorage.getItem("server") !== null;
} }
getServer(): Server { getServer(): Server {
return JSON.parse(localStorage.getItem("server") || '{"protocol":"https","host":"localhost","port":8080}'); return JSON.parse(localStorage.getItem("server") || '{"protocol":"https","host":"localhost","port":8124}');
} }
updateServer(server: Server): void { updateServer(server: Server): void {
localStorage.setItem("server", JSON.stringify(server)); localStorage.setItem("server", JSON.stringify(server));

View File

@ -15,11 +15,9 @@ export class BullpenSessionService {
} }
public save(bullpen: Bullpen): Promise<Bullpen> { public save(bullpen: Bullpen): Promise<Bullpen> {
console.log(JSON.stringify(bullpen, null, 2));
return api return api
.post('/bullpen_session', bullpen) .post('/bullpen_session', bullpen)
.then(response => { .then(response => {
console.log(JSON.stringify(response.data, null, 2));
return response.data; return response.data;
}, (error) => { }, (error) => {
console.log(JSON.stringify(error, null, 2)); console.log(JSON.stringify(error, null, 2));

View File

@ -22,7 +22,6 @@ class TokenService {
} }
setUser(user: UserInfo) { setUser(user: UserInfo) {
console.log(JSON.stringify(user));
localStorage.setItem("auth", JSON.stringify(user)); localStorage.setItem("auth", JSON.stringify(user));
} }

View File

@ -29,8 +29,6 @@ const pitcher = computed(() => store.state.auth.user);
const pitchTypes = computed(() => store.state.pitchTypes.pitchTypes); const pitchTypes = computed(() => store.state.pitchTypes.pitchTypes);
const bullpen = computed(() => store.state.bullpen); const bullpen = computed(() => store.state.bullpen);
console.log(JSON.stringify(bullpen.value.bullpen, null, 2));
const determinePitchTypeName = (id: number): string => { const determinePitchTypeName = (id: number): string => {
const pitchType = pitchTypes.value.find((pitchType: PitchType) => pitchType.id === id); const pitchType = pitchTypes.value.find((pitchType: PitchType) => pitchType.id === id);
@ -52,7 +50,7 @@ const gotoHome = () => {
<ion-title v-else>Bullpen Summary</ion-title> <ion-title v-else>Bullpen Summary</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content> <ion-content v-if="bullpen.bullpen">
<ion-card v-for="(pitch, index) in bullpen.bullpen.pitches" :key="index"> <ion-card v-for="(pitch, index) in bullpen.bullpen.pitches" :key="index">
<ion-card-header> <ion-card-header>
<ion-card-title>Pitch {{index+1}}</ion-card-title> <ion-card-title>Pitch {{index+1}}</ion-card-title>

View File

@ -15,28 +15,23 @@ const userImage = ref(null);
const pitcher = computed(() => store.state.auth.user); const pitcher = computed(() => store.state.auth.user);
const isAuthenticated = computed(() => store.state.auth.isAuthenticated); const isAuthenticated = computed(() => store.state.auth.isAuthenticated);
console.log('user', pitcher.value);
if (pitcher.value === undefined || pitcher.value === null || pitcher.value === '') { if (pitcher.value === undefined || pitcher.value === null || pitcher.value === '') {
router.push({ path: '/login' }); router.push({ path: '/login' });
} }
const startBullpen = () => { const startBullpen = () => {
console.log('Starting bullpen session');
router.push({ path: '/bullpen' }); router.push({ path: '/bullpen' });
}; };
const showStats = () => { const showStats = () => {
console.log('Showing bullpen stats');
router.push({ path: '/stats' }); router.push({ path: '/stats' });
}; };
const showProfile = () => { const showProfile = () => {
console.log('Showing profile');
router.push({ path: '/profile' }); router.push({ path: '/profile' });
}; };
const logout = () => { const logout = () => {
console.log('Logout');
store.dispatch('auth/logout').then(() => { store.dispatch('auth/logout').then(() => {
router.push({ path: '/' }); router.push({ path: '/' });
}, error => { }, error => {