Enhance type safety in BookNowPage and useAppointments hook. Update availableDates and availableDaysOfWeek mapping to specify string types. Add getUserAppointmentStats and AvailableDatesResponse types to useAppointments for improved type definitions. Modify Appointment interface to include 'completed' status for better appointment management.
This commit is contained in:
parent
a1611e1782
commit
9d3cc84816
@ -142,7 +142,7 @@ export default function BookNowPage() {
|
||||
const daysSet = new Set<string>();
|
||||
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
|
||||
availableDates.forEach((dateStr) => {
|
||||
availableDates.forEach((dateStr: string) => {
|
||||
try {
|
||||
// Parse date string (YYYY-MM-DD format)
|
||||
const [year, month, day] = dateStr.split('-').map(Number);
|
||||
@ -651,7 +651,7 @@ export default function BookNowPage() {
|
||||
) : (
|
||||
<>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{availableDaysOfWeek.map((day) => (
|
||||
{availableDaysOfWeek.map((day: string) => (
|
||||
<label
|
||||
key={day}
|
||||
className={`flex items-center gap-2 cursor-pointer px-4 py-2 rounded-lg border transition-all ${
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
getAvailableDates,
|
||||
listAppointments,
|
||||
getUserAppointments,
|
||||
getUserAppointmentStats,
|
||||
getAppointmentDetail,
|
||||
scheduleAppointment,
|
||||
rejectAppointment,
|
||||
@ -25,6 +26,8 @@ import type {
|
||||
Appointment,
|
||||
AdminAvailability,
|
||||
AppointmentStats,
|
||||
UserAppointmentStats,
|
||||
AvailableDatesResponse,
|
||||
JitsiMeetingInfo,
|
||||
} from "@/lib/models/appointments";
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ import {
|
||||
refreshToken,
|
||||
getStoredTokens,
|
||||
getStoredUser,
|
||||
getStoredUserSync,
|
||||
storeTokens,
|
||||
storeUser,
|
||||
clearAuthData,
|
||||
|
||||
@ -9,7 +9,7 @@ export interface Appointment {
|
||||
reason?: string;
|
||||
preferred_dates: string[]; // YYYY-MM-DD format
|
||||
preferred_time_slots: string[]; // "morning", "afternoon", "evening"
|
||||
status: "pending_review" | "scheduled" | "rejected";
|
||||
status: "pending_review" | "scheduled" | "rejected" | "completed";
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
scheduled_datetime?: string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user