Code formatting with prettier

This commit is contained in:
Ferdinand Thiessen 2021-01-28 23:08:34 +01:00
parent 1dc0603df3
commit a8ad2f1da5
3 changed files with 18 additions and 15 deletions

3
.gitignore vendored
View File

@ -2,6 +2,9 @@
.thumbs.db .thumbs.db
node_modules node_modules
# We use yarn, so ignore npm
package-lock.json
# Quasar core related directories # Quasar core related directories
.quasar .quasar
/dist /dist

View File

@ -3,7 +3,7 @@
<q-card> <q-card>
<q-form @submit="save" @reset="reset"> <q-form @submit="save" @reset="reset">
<q-card-section class="fit row justify-start content-center items-center"> <q-card-section class="fit row justify-start content-center items-center">
<q-card-section class="fit "> <q-card-section class="fit">
<div class="text-h6">Veranstaltung erstellen</div> <div class="text-h6">Veranstaltung erstellen</div>
</q-card-section> </q-card-section>
<q-select <q-select
@ -27,7 +27,7 @@
:rules="[noValidDate, notEmpty]" :rules="[noValidDate, notEmpty]"
/> />
</q-card-section> </q-card-section>
<q-card-section class="fit justify-start content-center items-center"> <q-card-section class="fit justify-start content-center items-center">
<q-input <q-input
class="col-xs-12 col-sm-6 q-pa-sm" class="col-xs-12 col-sm-6 q-pa-sm"
label="Beschreibung" label="Beschreibung"

View File

@ -25,7 +25,7 @@ function loadCurrentSession() {
const state: SessionInterface = { const state: SessionInterface = {
sessions: [], sessions: [],
currentSession: loadCurrentSession() || undefined, currentSession: loadCurrentSession() || undefined,
loading: false, loading: false
}; };
const mutations: MutationTree<SessionInterface> = { const mutations: MutationTree<SessionInterface> = {
@ -44,11 +44,11 @@ const mutations: MutationTree<SessionInterface> = {
state.loading = value; state.loading = value;
}, },
updateSession(state, session: FG.Session) { updateSession(state, session: FG.Session) {
const index = state.sessions.findIndex((x) => x.token == session.token); const index = state.sessions.findIndex(x => x.token == session.token);
if (index > -1) { if (index > -1) {
state.sessions[index] = session; state.sessions[index] = session;
} }
}, }
}; };
const actions: ActionTree<SessionInterface, StateInterface> = { const actions: ActionTree<SessionInterface, StateInterface> = {
@ -65,7 +65,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
commit('setCurrentSession', response.data.session); commit('setCurrentSession', response.data.session);
commit('user/setCurrentUser', response.data.user, { root: true }); commit('user/setCurrentUser', response.data.user, { root: true });
commit('user/setCurrentPermissions', response.data.permissions, { commit('user/setCurrentPermissions', response.data.permissions, {
root: true, root: true
}); });
}) })
.catch((error: AxiosError) => { .catch((error: AxiosError) => {
@ -78,7 +78,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
*/ */
logout({ dispatch, rootState }) { logout({ dispatch, rootState }) {
if (rootState.session.currentSession) { if (rootState.session.currentSession) {
dispatch('deleteSession', rootState.session.currentSession.token).catch((error) => { dispatch('deleteSession', rootState.session.currentSession.token).catch(error => {
console.log(error); console.log(error);
void dispatch('clearCurrent', false); void dispatch('clearCurrent', false);
}); });
@ -97,7 +97,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
if (token === rootState.session.currentSession?.token) { if (token === rootState.session.currentSession?.token) {
void dispatch('clearCurrent', false); void dispatch('clearCurrent', false);
} else { } else {
dispatch('getSessions').catch((error) => { dispatch('getSessions').catch(error => {
throw error; throw error;
}); });
} }
@ -116,7 +116,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
void Router.push({ void Router.push({
name: 'login', name: 'login',
query: redirect ? { redirect: Router.currentRoute.fullPath } : {}, query: redirect ? { redirect: Router.currentRoute.fullPath } : {},
params: { logout: 'true' }, params: { logout: 'true' }
}).then(() => { }).then(() => {
commit('clearCurrentSession'); commit('clearCurrentSession');
commit('user/clearCurrentUser', null, { root: true }); commit('user/clearCurrentUser', null, { root: true });
@ -132,7 +132,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
axios axios
.get('/auth') .get('/auth')
.then((response: AxiosResponse<FG.Session[]>) => { .then((response: AxiosResponse<FG.Session[]>) => {
response.data.forEach((session) => { response.data.forEach(session => {
session.expires = new Date(session.expires); session.expires = new Date(session.expires);
}); });
commit('setSessions', response.data); commit('setSessions', response.data);
@ -143,7 +143,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
commit('setCurrentSession', currentSession); commit('setCurrentSession', currentSession);
} }
}) })
.catch((error) => { .catch(error => {
throw error; throw error;
}) })
.finally(() => { .finally(() => {
@ -160,7 +160,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
commit('setCurrentSession', response.data); commit('setCurrentSession', response.data);
} }
}) })
.catch((err) => console.log(err)) .catch(err => console.log(err))
.finally(() => { .finally(() => {
commit('setLoading', false); commit('setLoading', false);
}); });
@ -173,7 +173,7 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
return axios.post('/auth/reset', data).catch((error: AxiosError) => { return axios.post('/auth/reset', data).catch((error: AxiosError) => {
return Promise.reject(error.response); return Promise.reject(error.response);
}); });
}, }
}; };
const getters: GetterTree<SessionInterface, StateInterface> = { const getters: GetterTree<SessionInterface, StateInterface> = {
@ -185,7 +185,7 @@ const getters: GetterTree<SessionInterface, StateInterface> = {
}, },
loading(state) { loading(state) {
return state.loading; return state.loading;
}, }
}; };
const sessions: Module<SessionInterface, StateInterface> = { const sessions: Module<SessionInterface, StateInterface> = {
@ -193,7 +193,7 @@ const sessions: Module<SessionInterface, StateInterface> = {
state, state,
mutations, mutations,
actions, actions,
getters, getters
}; };
export default sessions; export default sessions;