Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderUngefug committed Aug 28, 2024
1 parent 16dcefb commit 0d40778
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ router.beforeEach(async (to: RouteLocationNormalized, _from: RouteLocationNormal
const authStore: AuthStore = useAuthStore();

await authStore.initializeAuthStatus();

if (to.path != '/profile') sessionStorage.setItem('previousUrl', to.path);
// Redirect authenticated users trying to access the login page to the start page
if (to.path === '/' && authStore.isAuthed) {
return { path: '/start' };
Expand Down Expand Up @@ -49,7 +49,6 @@ router.beforeEach(async (to: RouteLocationNormalized, _from: RouteLocationNormal
return { path: 'not-found' };
}
}

return true;
});

Expand Down
3 changes: 0 additions & 3 deletions src/utils/routing.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/views/admin/KlasseCreationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import KlasseForm from '@/components/form/KlasseForm.vue';
import SuccessTemplate from '@/components/admin/klassen/SuccessTemplate.vue';
import { getValidationSchema, getVuetifyConfig } from '@/utils/validationKlasse';
import { setPreviousUrl } from '@/utils/routing';
const { t }: Composer = useI18n({ useScope: 'global' });
const router: Router = useRouter();
Expand Down Expand Up @@ -169,7 +168,6 @@ import { setPreviousUrl } from '@/utils/routing';
});
onMounted(async () => {
setPreviousUrl();
await personenkontextStore.processWorkflowStep({ limit: 25 });
organisationStore.createdKlasse = null;
organisationStore.errorCode = '';
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/KlasseDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import SuccessTemplate from '@/components/admin/klassen/SuccessTemplate.vue';
import KlasseDelete from '@/components/admin/klassen/KlasseDelete.vue';
import { getValidationSchema, getVuetifyConfig } from '@/utils/validationKlasse';
import { setPreviousUrl } from '@/utils/routing';
const route: RouteLocationNormalizedLoaded = useRoute();
const router: Router = useRouter();
Expand Down Expand Up @@ -143,7 +142,6 @@ import { setPreviousUrl } from '@/utils/routing';
}
onBeforeMount(async () => {
setPreviousUrl();
organisationStore.errorCode = '';
// Retrieves the Klasse using the Id in the route since that's all we have
await organisationStore.getOrganisationById(currentOrganisationId, OrganisationsTyp.Klasse);
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/KlassenManagementView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { useRouter, type Router } from 'vue-router';
import KlasseDelete from '@/components/admin/klassen/KlasseDelete.vue';
import SpshAlert from '@/components/alert/SpshAlert.vue';
import { setPreviousUrl } from '@/utils/routing';
const authStore: AuthStore = useAuthStore();
const organisationStore: OrganisationStore = useOrganisationStore();
Expand Down Expand Up @@ -342,7 +341,6 @@ import { setPreviousUrl } from '@/utils/routing';
router.push({ name: 'klasse-details', params: { id: item.id } });
}
onMounted(async () => {
setPreviousUrl();
await organisationStore.getAllOrganisationen({
offset: (searchFilterStore.klassenPage - 1) * searchFilterStore.klassenPerPage,
limit: searchFilterStore.klassenPerPage,
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/PersonCreationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import { useKlassen } from '@/composables/useKlassen';
import PersonenkontextCreate from '@/components/admin/personen/PersonenkontextCreate.vue';
import { type TranslatedObject } from '@/types.d';
import { setPreviousUrl } from '@/utils/routing';
const router: Router = useRouter();
const personStore: PersonStore = usePersonStore();
Expand Down Expand Up @@ -249,7 +248,6 @@ import { setPreviousUrl } from '@/utils/routing';
});
onMounted(async () => {
setPreviousUrl();
await personenkontextStore.processWorkflowStep({ limit: 25 });
personStore.errorCode = '';
personenkontextStore.createdPersonWithKontext = null;
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/PersonDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import PersonenkontextCreate from '@/components/admin/personen/PersonenkontextCreate.vue';
import { type TranslatedObject } from '@/types.d';
import KlasseChange from '@/components/admin/klassen/KlasseChange.vue';
import { setPreviousUrl } from '@/utils/routing';
const { mdAndDown }: { mdAndDown: Ref<boolean> } = useDisplay();
Expand Down Expand Up @@ -705,7 +704,6 @@
}
onBeforeMount(async () => {
setPreviousUrl();
personStore.resetState();
personenkontextStore.errorCode = '';
await personStore.getPersonById(currentPersonId);
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/PersonManagementView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import ResultTable, { type TableRow } from '@/components/admin/ResultTable.vue';
import SearchField from '@/components/admin/SearchField.vue';
import { type TranslatedObject } from '@/types.d';
import { setPreviousUrl } from '@/utils/routing';
const searchFieldComponent: Ref = ref();
Expand Down Expand Up @@ -288,7 +287,6 @@
}
onMounted(async () => {
setPreviousUrl();
if (filterOrSearchActive.value) {
selectedSchulen.value = searchFilterStore.selectedSchulen || [];
selectedRollen.value = searchFilterStore.selectedRollen || [];
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/SchuleCreationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { object, string } from 'yup';
import { toTypedSchema } from '@vee-validate/yup';
import { DIN_91379A_EXT, NO_LEADING_TRAILING_SPACES } from '@/utils/validation';
import { setPreviousUrl } from '@/utils/routing';
const { mdAndDown }: { mdAndDown: Ref<boolean> } = useDisplay();
Expand Down Expand Up @@ -135,7 +134,6 @@
}
onMounted(async () => {
setPreviousUrl();
organisationStore.createdSchule = null;
/* listen for browser changes and prevent them when form is dirty */
window.addEventListener('beforeunload', preventNavigation);
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/SchuleManagementView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import type { VDataTableServer } from 'vuetify/lib/components/index.mjs';
import { OrganisationsTyp, useOrganisationStore, type OrganisationStore } from '@/stores/OrganisationStore';
import { type SearchFilterStore, useSearchFilterStore } from '@/stores/SearchFilterStore';
import { setPreviousUrl } from '@/utils/routing';
const organisationStore: OrganisationStore = useOrganisationStore();
const searchFilterStore: SearchFilterStore = useSearchFilterStore();
Expand Down Expand Up @@ -49,7 +48,6 @@
}
onMounted(async () => {
setPreviousUrl();
await organisationStore.getAllOrganisationen({
offset: (searchFilterStore.schulenPage - 1) * searchFilterStore.schulenPerPage,
limit: searchFilterStore.schulenPerPage,
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/rollen/RolleCreationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
} from '@/utils/validationRolle';
import SuccessTemplate from '@/components/admin/rollen/SuccessTemplate.vue';
import { type TranslatedObject } from '@/types.d';
import { setPreviousUrl } from '@/utils/routing';
const rolleStore: RolleStore = useRolleStore();
const organisationStore: OrganisationStore = useOrganisationStore();
Expand Down Expand Up @@ -181,7 +180,6 @@
}
onMounted(async () => {
setPreviousUrl();
rolleStore.createdRolle = null;
await organisationStore.getAllOrganisationen({
systemrechte: ['ROLLEN_VERWALTEN'],
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/rollen/RolleDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import RolleDelete from '@/components/admin/rollen/RolleDelete.vue';
import { type TranslatedObject } from '@/types.d';
import SuccessTemplate from '@/components/admin/rollen/SuccessTemplate.vue';
import { setPreviousUrl } from '@/utils/routing';
const route: RouteLocationNormalizedLoaded = useRoute();
const router: Router = useRouter();
Expand Down Expand Up @@ -243,7 +242,6 @@ import { setPreviousUrl } from '@/utils/routing';
};
onBeforeMount(async () => {
setPreviousUrl();
rolleStore.errorCode = '';
await rolleStore.getRolleById(currentRolleId);
await organisationStore.getOrganisationById(
Expand Down
2 changes: 0 additions & 2 deletions src/views/admin/rollen/RolleManagementView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import { useOrganisationStore, type Organisation, type OrganisationStore } from '@/stores/OrganisationStore';
import { useRouter, type Router } from 'vue-router';
import { useSearchFilterStore, type SearchFilterStore } from '@/stores/SearchFilterStore';
import { setPreviousUrl } from '@/utils/routing';
const rolleStore: RolleStore = useRolleStore();
const organisationStore: OrganisationStore = useOrganisationStore();
Expand Down Expand Up @@ -95,7 +94,6 @@ import { setPreviousUrl } from '@/utils/routing';
}
onMounted(async () => {
setPreviousUrl();
await organisationStore.getAllOrganisationen();
await rolleStore.getAllRollen({
offset: (searchFilterStore.rollenPage - 1) * searchFilterStore.rollenPerPage,
Expand Down

0 comments on commit 0d40778

Please sign in to comment.