This commit is contained in:
Salihu committed 2026-09-09 14:09:44 +01:00
1 parent 4d973ba40a
commit 36eb3837e0
3 files changed
+14 -9

No files matched your search

@@ -60,10 +60,10 @@ function InnerPublicAccess(
const userLocale = useUserLocale();
const currentDate = React.useRef<Date>(new Date());
const [expiryType, setExpiryType] = React.useState<ExpiryType>(
ExpiryType.Month
ExpiryType.NoExpiration
);
const [expiresAt, setExpiresAt] = React.useState<Date | undefined>(() =>
calculateExpiryDate(currentDate.current, ExpiryType.Month)
const [expiresAt, setExpiresAt] = React.useState<Date | undefined>(
new Date()
);
const expiryOptions = React.useMemo<Option[]>(
@@ -102,7 +102,7 @@ function InnerPublicAccess(
setExpiresAt(parsedExpiresAt);
setExpiryType(matchedType ?? ExpiryType.Custom);
}, [share?.expiresAt]);
}, []);
const handlePublishedChange = React.useCallback(
async (checked: boolean) => {
@@ -71,10 +71,10 @@ function PublicAccess(
const userLocale = useUserLocale();
const currentDate = React.useRef<Date>(new Date());
const [expiryType, setExpiryType] = React.useState<ExpiryType>(
ExpiryType.Month
ExpiryType.NoExpiration
);
const [expiresAt, setExpiresAt] = React.useState<Date | undefined>(() =>
calculateExpiryDate(currentDate.current, ExpiryType.Month)
const [expiresAt, setExpiresAt] = React.useState<Date | undefined>(
new Date()
);
const expiryOptions = React.useMemo<Option[]>(
@@ -113,7 +113,7 @@ function PublicAccess(
setExpiresAt(parsedExpiresAt);
setExpiryType(matchedType ?? ExpiryType.Custom);
}, [share?.expiresAt]);
}, []);
const handlePublishedChange = React.useCallback(
async (checked: boolean) => {
+6 -1
View File
@@ -53,7 +53,12 @@ export type SharesListReq = z.infer<typeof SharesListSchema>;
export const SharesUpdateSchema = BaseSchema.extend({
body: z.object({
id: z.uuid(),
expiresAt: z.coerce.date().nullish(),
expiresAt: z.coerce
.date()
.nullish()
.refine((value) => !value || isTodayOrAfter(value), {
error: "must be today or later",
}),
includeChildDocuments: z.boolean().optional(),
published: z.boolean().optional(),
allowIndexing: z.boolean().optional(),