Clean up all kinds of typescript issues

This commit is contained in:
2024-05-05 15:58:58 -04:00
parent 634cff507c
commit 8e73650462
21 changed files with 380 additions and 159 deletions

View File

@@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import { ID, account } from 'boot/appwrite';
import type { Models } from 'appwrite';
import { OAuthProvider, type Models } from 'appwrite';
import { ref } from 'vue';
export const useAuthStore = defineStore('auth', () => {
@@ -21,12 +21,12 @@ export const useAuthStore = defineStore('auth', () => {
return await login(email, password);
}
async function login(email: string, password: string) {
await account.createEmailSession(email, password);
await account.createEmailPasswordSession(email, password);
currentUser.value = await account.get();
}
async function googleLogin() {
account.createOAuth2Session(
'google',
OAuthProvider.Google,
'https://bab.toal.ca/',
'https://bab.toal.ca/#/login'
);

View File

@@ -13,10 +13,10 @@ export interface Boat extends Models.Document {
year?: number;
imgSrc?: string;
iconSrc?: string;
bookingAvailable?: boolean;
bookingAvailable: boolean;
requiredCerts: string[];
maxPassengers: number;
defects?: {
defects: {
type: string;
severity: string;
description: string;

View File

@@ -44,7 +44,7 @@ export function getSampleTimeBlocks(): Timeblock[] {
for (let i = 0; i <= 30; i++) {
const template = templateB;
result.push(
...boats
...boats.value
.map((b): Timeblock[] => {
return template.blocks.map((t): Timeblock => {
return {
@@ -126,7 +126,7 @@ export function getSampleReservations(): Reservation[] {
};
return sampleData.map((entry): Reservation => {
const boat = <Boat>boatStore.boats.find((b) => b.$id == entry.boat);
const boat = <Boat>boatStore.boats.value.find((b) => b.$id == entry.boat);
return {
id: entry.id,
user: entry.user,

View File

@@ -18,12 +18,12 @@ export interface Reservation {
objects in here? */
export type timeTuple = [start: string, end: string];
export interface Timeblock extends Models.Document {
export type Timeblock = Partial<Models.Document> & {
boatId: string;
start: string;
end: string;
selected?: false;
}
};
export interface TimeBlockTemplate {
id: string;