Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetskilinc committed Oct 29, 2024
1 parent 3032c7f commit 6982bb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import AppointmentsList from "./views/AppointmentsList";
import BeforeNavLinks from "./components/Appointments/BeforeNavLinks";
import AppointmentsListMe from "./views/AppointmentsListMe";
import OpeningTimes from "./globals/OpeningTimes";
import { onInitExtension } from "./onInitExtension";

export const appointments =
(pluginOptions?: PluginTypes): Plugin =>
Expand Down Expand Up @@ -108,5 +109,11 @@ export const appointments =
...(config.hooks || {}),
};

config.onInit = async payload => {
if (incomingConfig.onInit) await incomingConfig.onInit(payload);
// Add additional onInit code by using the onInitExtension function
onInitExtension(payload, pluginOptions);

Check failure on line 115 in src/plugin.ts

View workflow job for this annotation

GitHub Actions / build

Argument of type 'PluginTypes | undefined' is not assignable to parameter of type 'Payload'.
};

return config;
};
10 changes: 7 additions & 3 deletions src/views/AppointmentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@ const AppointmentsList: AdminViewComponent = ({ user, canAccessAdmin }) => {

const [
{
data: { docs: users },
data: { docs: admins },
},
] = usePayloadAPI(`${serverURL}${api}/${admin.user}`);

const takingAppointments = admins?.filter(
(user: User) => user.takingAppointments
);

return (
<AppointmentProvider>
<DefaultTemplate>
<div className="collection-list appointments-calendar-view">
<h1>Appointments List</h1>
{users && appointments ? (
{takingAppointments && appointments ? (
<Calendar
resources={users.filter((user: User) => user.takingAppointments)}
resources={takingAppointments}
events={appointments}
/>
) : null}
Expand Down

0 comments on commit 6982bb4

Please sign in to comment.