Feature parity with admins and users (also a minor backend change)

This commit is contained in:
augmentedpotato
2026-04-07 23:23:05 -06:00
parent ffef9243dd
commit 83477904be
3 changed files with 8 additions and 18 deletions

View File

@@ -224,7 +224,7 @@ function AppointmentsPage() {
const [appointments, setAppointments] = useState([]);
const [loadingAppointments, setLoadingAppointments] = useState(false);
const canBookAppointments = user?.role === "CUSTOMER";
const canBookAppointments = user?.role === "CUSTOMER" || user?.role === "ADMIN";
useEffect(() => {
if (!authLoading && !user) {
@@ -410,12 +410,6 @@ function AppointmentsPage() {
return;
}
if (!user?.customerId) {
setError("Customer account not found. Please contact support.");
return;
}
if (selectedPetIds.length === 0) {
setError(isAdoptionService ? "Please select a pet to adopt." : "Please select at least one pet.");
@@ -426,7 +420,7 @@ function AppointmentsPage() {
try {
const body = {
customerId: user.customerId,
customerId: user.customerId || user.id,
storeId: Number(storeId),
serviceId: Number(serviceId),
employeeId: employeeId ? Number(employeeId) : undefined,
@@ -435,12 +429,8 @@ function AppointmentsPage() {
appointmentStatus: "Booked",
};
if (isCustomerPetService) {
body.customerPetIds = selectedPetIds;
}
else {
body.petIds = selectedPetIds;
if (selectedPetIds.length > 0) {
body.petId = selectedPetIds[0];
}
const res = await fetch(`${API_BASE}/api/v1/appointments`, {