mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
feat: enhance terms acceptance response to include acceptance timestamp
This commit is contained in:
parent
4fe9e98442
commit
d6d61254ad
3 changed files with 7 additions and 3 deletions
|
|
@ -96,7 +96,10 @@ const acceptTermsController = async (req, res) => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return res.status(404).json({ message: 'User not found' });
|
return res.status(404).json({ message: 'User not found' });
|
||||||
}
|
}
|
||||||
res.status(200).json({ message: 'Terms accepted successfully' });
|
res.status(200).json({
|
||||||
|
message: 'Terms accepted successfully',
|
||||||
|
termsAcceptedAt: user.termsAcceptedAt,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Error accepting terms:', error);
|
logger.error('Error accepting terms:', error);
|
||||||
res.status(500).json({ message: 'Error accepting terms' });
|
res.status(500).json({ message: 'Error accepting terms' });
|
||||||
|
|
|
||||||
|
|
@ -1068,7 +1068,7 @@ export const useAcceptTermsMutation = (
|
||||||
onSuccess: (data, variables, context) => {
|
onSuccess: (data, variables, context) => {
|
||||||
queryClient.setQueryData<t.TUserTermsResponse>([QueryKeys.userTerms], {
|
queryClient.setQueryData<t.TUserTermsResponse>([QueryKeys.userTerms], {
|
||||||
termsAccepted: true,
|
termsAccepted: true,
|
||||||
termsAcceptedAt: new Date().toISOString(),
|
termsAcceptedAt: data.termsAcceptedAt,
|
||||||
});
|
});
|
||||||
options?.onSuccess?.(data, variables, context);
|
options?.onSuccess?.(data, variables, context);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -627,7 +627,8 @@ export type TUserTermsResponse = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TAcceptTermsResponse = {
|
export type TAcceptTermsResponse = {
|
||||||
success: boolean;
|
message: string;
|
||||||
|
termsAcceptedAt: Date | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TBannerResponse = TBanner | null;
|
export type TBannerResponse = TBanner | null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue