lastUsed update resolution to 1 hour

This commit is contained in:
Marc-Roig 2023-06-26 11:17:51 +02:00
parent d535798aaa
commit d3323219c3
No known key found for this signature in database
GPG Key ID: FB4E2C43A0BEE249

View File

@ -54,9 +54,9 @@ const authenticate = async (ctx) => {
}
}
// update lastUsedAt if the token has not been used for 24 hours
// update lastUsedAt if the token has not been used in the last hour
const hoursSinceLastUsed = differenceInHours(currentDate, parseISO(apiToken.lastUsedAt));
if (hoursSinceLastUsed >= 24) {
if (hoursSinceLastUsed >= 1) {
await strapi.query('admin::api-token').update({
where: { id: apiToken.id },
data: { lastUsedAt: currentDate },