auth change to log on redisRestClient

This commit is contained in:
DirkSchlossmacher
2023-11-13 12:57:09 +01:00
parent 145701dc3e
commit 1ad18ca1c8
2 changed files with 41 additions and 0 deletions

View File

@@ -14,6 +14,28 @@ const headers = {
'Content-Type': 'application/json',
};
export const incrementSignInCount = async (email: string | undefined, dateKey: string) => {
if (!email) {
console.error('Email is undefined, cannot increment sign-in count.');
return;
}
const response = await fetch(`${redisRestUrl}/hincrby`, {
method: 'POST',
headers: headers,
body: JSON.stringify({
key: `signin_count:${email}`,
field: dateKey,
increment: 1
}),
});
if (!response.ok) {
console.error('Failed to increment sign-in count in Redis via REST API');
}
};
export const incrementSessionRefreshCount = async (email: string | undefined, dateKey: string) => {
if (!email) {
console.error('Email is undefined, cannot increment session refresh count.');