release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
4 changed files with 32 additions and 35 deletions
Showing only changes of commit fd71f08430 - Show all commits

View File

@ -24,7 +24,7 @@ module.exports = configure(function(ctx) {
// app boot file (/src/boot) // app boot file (/src/boot)
// --> boot files are part of "main.js" // --> boot files are part of "main.js"
// https://quasar.dev/quasar-cli/boot-files // https://quasar.dev/quasar-cli/boot-files
boot: ['composition-api', 'axios', 'login', 'plugins'], boot: ['composition-api', 'axios', 'login', 'plugins', 'loading'],
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css
css: ['app.scss'], css: ['app.scss'],

10
src/boot/loading.ts Normal file
View File

@ -0,0 +1,10 @@
import { boot } from 'quasar/wrappers';
import { Loading } from 'quasar';
// "async" is optional;
// more info on params: https://quasar.dev/quasar-cli/cli-documentation/boot-files#Anatomy-of-a-boot-file
export default boot(async (/* { app, router, Vue ... } */) => {
Loading.setDefaults({
spinner: () => import('src/components/loading/DarkCircularProgress.vue')
});
});

View File

@ -16,20 +16,20 @@ export interface LoginResponse {
} }
const empty_session: FG.Session = { const empty_session: FG.Session = {
browser: '', browser: '',
expires: new Date(), expires: new Date(),
lifetime: -1, lifetime: -1,
platform: '', platform: '',
token: '' token: ''
}; };
const empty_user: FG.User = { const empty_user: FG.User = {
display_name: '', display_name: '',
firstname: '', firstname: '',
lastname: '', lastname: '',
mail: '', mail: '',
roles: [], roles: [],
userid: '' userid: ''
}; };
const state: UserStateInterface = { const state: UserStateInterface = {
@ -56,9 +56,6 @@ const mutations: MutationTree<UserStateInterface> = {
const actions: ActionTree<UserStateInterface, StateInterface> = { const actions: ActionTree<UserStateInterface, StateInterface> = {
login({ commit }, data: LoginData) { login({ commit }, data: LoginData) {
commit('setLoginLoading', true); commit('setLoginLoading', true);
Loading.setDefaults({
spinner: () => import('src/components/loading/DarkCircularProgress.vue')
});
Loading.show({ Loading.show({
message: 'Du wirst eingeloggt' message: 'Du wirst eingeloggt'
}); });
@ -83,7 +80,7 @@ const actions: ActionTree<UserStateInterface, StateInterface> = {
}); });
}, },
doLogout({commit}, token: string) { doLogout({ commit }, token: string) {
Loading.show({ message: 'Du wirst ausgeloggt' }); Loading.show({ message: 'Du wirst ausgeloggt' });
void axios void axios
.delete(`/auth/${token}`) .delete(`/auth/${token}`)
@ -98,8 +95,10 @@ const actions: ActionTree<UserStateInterface, StateInterface> = {
}); });
}, },
logout({ dispatch}, token: string) { logout({ dispatch }, token: string) {
dispatch('doLogout', token).finally(() => {void Router.push({ name: 'login' });}); dispatch('doLogout', token).finally(() => {
void Router.push({ name: 'login' });
});
}, },
updateUser({ commit, state }, data) { updateUser({ commit, state }, data) {
@ -117,19 +116,9 @@ const actions: ActionTree<UserStateInterface, StateInterface> = {
loadFromLocalStorage({ commit }) { loadFromLocalStorage({ commit }) {
console.log('load from store'); console.log('load from store');
let data = LocalStorage.getItem('user'); let data = LocalStorage.getItem('user');
commit( commit('setUser', data ? data : empty_user);
'setUser',
data
? data
: empty_user
);
data = LocalStorage.getItem('session'); data = LocalStorage.getItem('session');
commit( commit('setSession', data ? data : empty_session);
'setSession',
data
? data
: empty_session
);
commit('showState'); commit('showState');
} }
}; };

View File

@ -1,6 +1,5 @@
import { store } from 'quasar/wrappers'; import { store } from 'quasar/wrappers';
import { SessionInterface } from 'src/plugins/user/store/session'; import { SessionInterface } from 'src/plugins/user/store/session';
import { UserStateInterface } from 'src/plugins/user/store/user';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { UserStateInterface } from 'src/plugins/user/store/user'; import { UserStateInterface } from 'src/plugins/user/store/user';
@ -9,12 +8,11 @@ import { UserStateInterface } from 'src/plugins/user/store/user';
* directly export the Store instantiation * directly export the Store instantiation
*/ */
export interface StateInterface { export interface StateInterface {
user: UserStateInterface, user: UserStateInterface;
sessions: SessionInterface sessions: SessionInterface;
} }
export default store(function({ Vue }) {
export default store(function ({ Vue }) {
Vue.use(Vuex); Vue.use(Vuex);
const Store = new Vuex.Store<StateInterface>({ const Store = new Vuex.Store<StateInterface>({