Skip to content

Commit

Permalink
fix: cypress types
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutV committed Mar 29, 2024
1 parent c437297 commit 751a170
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions frontend/src/components/LanguageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ const localeStorage = useLocalStorage('locale', locale.value);
*
* @param locale
*/
function updateLocale(locale: Ref<string>) {
function updateLocale(locale: string) {
// Update saved locale
localeStorage.value = locale.value;
localeStorage.value = locale;
// Update PrimeVue locale
config.locale = messages.value[locale.value]['primevue'] as PrimeVueLocaleOptions;
config.locale = messages.value[locale]['primevue'] as PrimeVueLocaleOptions;
}
/**
Expand All @@ -40,12 +39,12 @@ function getFlag(locale: string) {
/* Hooks */
onMounted(() => {
updateLocale(locale);
updateLocale(locale.value);
});
</script>

<template>
<Dropdown id="language" v-model="locale" class="w-auto" :options="availableLocales" @change="updateLocale" variant="outlined">
<Dropdown id="language" v-model="locale" class="w-auto" :options="availableLocales" @change="updateLocale($event.value)" variant="outlined">
<template #option="{ option }">
<div class="flex align-items-center">
<img :alt="t('layout.header.language.' + option)" :src="getFlag(option)" class="h-1rem mr-2"/>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/projects/GroupCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const props = defineProps<{
}>();
onMounted(async () => {
await getStudentsByGroup(props.groupId, t);
await getStudentsByGroup(props.groupId);
});
</script>
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/composables/services/admins.service.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import {Admin} from '@/types/Admin.ts';
import {ref} from 'vue';
import {endpoints} from '@/config/endpoints.ts';
import { get, getList, create, delete_id } from '@/composables/services/helpers.ts';
import {User} from '@/types/User.ts';

export function useAdmin() {
const admins = ref<Admin[]|null>(null);
const admin = ref<Admin|null>(null);
const admins = ref<User[]|null>(null);
const admin = ref<User|null>(null);

async function getAdminByID(id: string) {
const endpoint = endpoints.admins.retrieve.replace('{id}', id);
await get<Admin>(endpoint, admin, Admin.fromJSON);
await get<User>(endpoint, admin, User.fromJSON);
}

async function getAdmins() {
const endpoint = endpoints.admins.index;
await getList<Admin>(endpoint, admins, Admin.fromJSON);
await getList<User>(endpoint, admins, User.fromJSON);
}

async function createAdmin(admin_data: Admin) {
async function createAdmin(admin_data: User) {
const endpoint = endpoints.admins.index;
await create<Admin>(endpoint,
await create<User>(endpoint,
{
email:admin_data.email,
first_name:admin_data.first_name,
last_name: admin_data.last_name
},
admin, Admin.fromJSON);
admin, User.fromJSON);
}

async function deleteAdmin(id: string) {
const endpoint = endpoints.admins.retrieve.replace('{id}', id);
await delete_id<Admin>(endpoint, admin, Admin.fromJSON);
await delete_id<User>(endpoint, admin, User.fromJSON);
}

return {
Expand Down
1 change: 1 addition & 0 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"types": ["cypress"],

/* Bundler mode */
"moduleResolution": "bundler",
Expand Down

0 comments on commit 751a170

Please sign in to comment.