fix: salt issues
This commit is contained in:
@@ -3,20 +3,6 @@ import { generateSalt } from '@openpanel/common/server';
|
||||
import { cacheableLru } from '@openpanel/redis';
|
||||
import { db } from '../prisma-client';
|
||||
|
||||
export async function getCurrentSalt() {
|
||||
const salt = await db.salt.findFirst({
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
});
|
||||
|
||||
if (!salt) {
|
||||
throw new Error('No salt found');
|
||||
}
|
||||
|
||||
return salt.salt;
|
||||
}
|
||||
|
||||
export const getSalts = cacheableLru(
|
||||
'op:salt',
|
||||
async () => {
|
||||
@@ -31,13 +17,9 @@ export const getSalts = cacheableLru(
|
||||
throw new Error('No salt found');
|
||||
}
|
||||
|
||||
if (!prev) {
|
||||
throw new Error('No salt found');
|
||||
}
|
||||
|
||||
const salts = {
|
||||
current: curr.salt,
|
||||
previous: prev.salt,
|
||||
previous: prev?.salt ?? curr.salt,
|
||||
};
|
||||
|
||||
return salts;
|
||||
|
||||
Reference in New Issue
Block a user