routing improved, settings initialized

This commit is contained in:
Torsten Schulz
2024-07-21 18:47:45 +02:00
parent 12d66d6f9c
commit cd0699f3fd
23 changed files with 476 additions and 69 deletions

View File

@@ -39,7 +39,7 @@ export default {
const response = await apiClient.post('/api/auth/activate', { token: this.token });
if (response.status === 200) {
this.user.active = true;
this.$router.push('/'); // Redirect to login after activation
this.$router.push('/settings/personal');
}
} catch (error) {
console.error('Error activating account:', error);

View File

@@ -38,6 +38,7 @@
<RandomChatDialog ref="randomChatDialog" />
<RegisterDialog ref="registerDialog" />
<PasswordResetDialog ref="passwordResetDialog" />
<ErrorDialog ref="errorDialog" />
</div>
</template>
@@ -47,6 +48,7 @@ import RegisterDialog from '@/dialogues/auth/RegisterDialog.vue';
import PasswordResetDialog from '@/dialogues/auth/PasswordResetDialog.vue';
import apiClient from '@/utils/axios.js';
import { mapActions } from 'vuex';
import ErrorDialog from '@/dialogues/standard/ErrorDialog.vue';
export default {
name: 'HomeNoLoginView',
@@ -60,6 +62,7 @@ export default {
RandomChatDialog,
RegisterDialog,
PasswordResetDialog,
ErrorDialog,
},
methods: {
...mapActions(['login']),
@@ -73,8 +76,16 @@ export default {
this.$refs.passwordResetDialog.open();
},
async doLogin() {
const response = await apiClient.post('/api/auth/login', { username: this.username, password: this.password });
this.login(response.data);
try {
const response = await apiClient.post('/api/auth/login', { username: this.username, password: this.password });
this.login(response.data);
if (response.data.forwardDataInput) {
console.log(response.data);
this.$router.push({ path: '/settings/personal' });
}
} catch (error) {
this.$refs.errorDialog.open(`tr:error.${error.response.data.error}`);
}
}
}
};

View File

@@ -0,0 +1,11 @@
<template>
<div>
Persönliche Einstellungen
</div>
</template>
<script>
export default {
name: 'PersonalSettingsView',
}
</script>