fix:#30 format, lint and fixed types

This commit is contained in:
Elmar Kresse
2024-02-23 02:50:01 +01:00
parent b4caa9e94b
commit 27b1b591cc
5 changed files with 38 additions and 30 deletions

View File

@@ -10,7 +10,11 @@ export async function createIndividualFeed(modules: Module[]): Promise<string> {
body: JSON.stringify(modules), body: JSON.stringify(modules),
}); });
if (response.status === 429 || response.status === 500 || response.status != 200) { if (
response.status === 429 ||
response.status === 500 ||
response.status != 200
) {
return Promise.reject(response.statusText); return Promise.reject(response.statusText);
} }

View File

@@ -37,7 +37,9 @@ const columns = computed(() => [
const toast = useToast(); const toast = useToast();
async function finalStep() { async function finalStep() {
const createFeed: Promise<string>= createIndividualFeed(store.getAllModules()); const createFeed: Promise<string> = createIndividualFeed(
store.getAllModules(),
);
// Check if createFeed Promise is resolved // Check if createFeed Promise is resolved
createFeed.then(async (token: string) => { createFeed.then(async (token: string) => {

View File

@@ -18,7 +18,7 @@ const props = defineProps({
type: Date, type: Date,
required: false, required: false,
default: null, default: null,
} },
}); });
type CalenderEvent = { type CalenderEvent = {
@@ -28,7 +28,7 @@ type CalenderEvent = {
showFree: boolean; showFree: boolean;
}; };
const propDate: Ref<Date|null> = ref(props.date); const propDate: Ref<Date | null> = ref(props.date);
const currentDateFrom: Ref<string> = ref(""); const currentDateFrom: Ref<string> = ref("");
const currentDateTo: Ref<string> = ref(""); const currentDateTo: Ref<string> = ref("");
@@ -131,14 +131,13 @@ const calendarOptions: ComputedRef<CalendarOptions> = computed(() => ({
}, },
datesSet: function (dateInfo: DatesSetArg) { datesSet: function (dateInfo: DatesSetArg) {
if (propDate.value !== null) {
if(propDate.value !== null) {
console.debug("props.date: ", props.date); console.debug("props.date: ", props.date);
const date = new Date(props.date); const date = new Date(props.date);
// calculate the week start and end date which includes the date // calculate the week start and end date which includes the date
const weekStart = new Date(date); const weekStart = new Date(date);
weekStart.setDate(date.getDate() - date.getDay()+1); weekStart.setDate(date.getDate() - date.getDay() + 1);
const weekEnd = new Date(date); const weekEnd = new Date(date);
weekEnd.setDate(date.getDate() - date.getDay() + 6); weekEnd.setDate(date.getDate() - date.getDay() + 6);
currentDateFrom.value = weekStart.toISOString().split("T")[0]; currentDateFrom.value = weekStart.toISOString().split("T")[0];
@@ -147,7 +146,9 @@ const calendarOptions: ComputedRef<CalendarOptions> = computed(() => ({
} else { } else {
const view = dateInfo.view; const view = dateInfo.view;
const offset = new Date().getTimezoneOffset(); const offset = new Date().getTimezoneOffset();
const startDate = new Date(view.activeStart.getTime() - offset * 60 * 1000); const startDate = new Date(
view.activeStart.getTime() - offset * 60 * 1000,
);
const endDate = new Date(view.activeEnd.getTime() - offset * 60 * 1000); const endDate = new Date(view.activeEnd.getTime() - offset * 60 * 1000);
currentDateFrom.value = startDate.toISOString().split("T")[0]; currentDateFrom.value = startDate.toISOString().split("T")[0];
currentDateTo.value = endDate.toISOString().split("T")[0]; currentDateTo.value = endDate.toISOString().split("T")[0];

View File

@@ -142,14 +142,13 @@ const filters = ref({
function occupationRoute(room: string): void { function occupationRoute(room: string): void {
// date is in format like YYYYMMDD // date is in format like YYYYMMDD
router.push({ router.push({
name: "room-schedule", name: "room-schedule",
query: { query: {
room: room, room: room,
date: date.value.toISOString().split("T")[0].replace(/-/g, ""), date: date.value.toISOString().split("T")[0].replace(/-/g, ""),
} },
} });
);
} }
const date: Ref<Date> = ref(new Date(Date.now())); const date: Ref<Date> = ref(new Date(Date.now()));

View File

@@ -22,22 +22,24 @@ const room = urlParams.get("room");
const roomsList = computedAsync(async () => { const roomsList = computedAsync(async () => {
let rooms: { name: string }[] = []; let rooms: { name: string }[] = [];
return await fetchRoom().then((data) => return await fetchRoom()
rooms = data.map((room: string) => { .then(
return { name: room }; (data) =>
}), (rooms = data.map((room: string) => {
).finally(() => { return { name: room };
if (room) { })),
// check if room is available in roomsList )
isRoomAvailable(room, rooms) .finally(() => {
} if (room) {
}); // check if room is available in roomsList
}, isRoomAvailable(room, rooms);
[]); }
});
}, []);
const selectedDate: Ref<Date|null> = ref(null); const selectedDate: Ref<Date | undefined> = ref(undefined);
// Set the selected date from the URL // Set the selected date from the UR
const date = urlParams.get("date"); const date = urlParams.get("date");
if (date) { if (date) {
// date is in format like YYYYMMDD // date is in format like YYYYMMDD