chore: removed redundant user check on session controller

This commit is contained in:
canove
2020-10-12 18:43:19 -03:00
parent 27015f12b2
commit 09f8ef9be0
2 changed files with 1 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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"]
});