2025-06-30 18:58:24 +02:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: © 2025 Hornwitser <code@hornwitser.no>
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
*/
|
2025-06-13 22:01:42 +02:00
|
|
|
import { Info } from "~/shared/utils/luxon";
|
|
|
|
|
|
|
|
export default definePayloadPlugin(() => {
|
|
|
|
definePayloadReducer(
|
|
|
|
"ClientSchedule",
|
|
|
|
data => {
|
|
|
|
if (!(data instanceof ClientSchedule)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const accountStore = useAccountStore();
|
|
|
|
return {
|
|
|
|
timezone: accountStore.activeTimezone,
|
|
|
|
locale: accountStore.activeLocale,
|
|
|
|
api: data.toApi(false)
|
|
|
|
};
|
|
|
|
},
|
|
|
|
);
|
|
|
|
definePayloadReviver(
|
|
|
|
"ClientSchedule",
|
|
|
|
({ timezone, locale, api }) => {
|
|
|
|
const zone = Info.normalizeZone(timezone);
|
|
|
|
return ClientSchedule.fromApi(api, { zone, locale })
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|