mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 11:49:19 +00:00
chore: removed redundant user check on session controller
This commit is contained in:
@@ -30,10 +30,6 @@ export const RefreshTokenService = async (token: string): Promise<Response> => {
|
||||
|
||||
const user = await ShowUserService(id);
|
||||
|
||||
if (!user) {
|
||||
throw new AppError("No user found with this ID.", 401);
|
||||
}
|
||||
|
||||
if (user.tokenVersion !== tokenVersion) {
|
||||
throw new AppError("Session revoked. Please login.", 401);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import User from "../../models/User";
|
||||
import AppError from "../../errors/AppError";
|
||||
|
||||
const ShowUserService = async (
|
||||
id: string | number
|
||||
): Promise<User | undefined> => {
|
||||
const ShowUserService = async (id: string | number): Promise<User> => {
|
||||
const user = await User.findByPk(id, {
|
||||
attributes: ["name", "id", "email", "profile", "tokenVersion"]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user