mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-22 17:19:39 +02:00
fix: fix compilation
This commit is contained in:
@@ -119,7 +119,7 @@ export function handleError(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getUser(req: express.Request) {
|
export async function getUser(req: express.Request) {
|
||||||
function notConnected() {
|
function notConnected(): never {
|
||||||
req.logout((error) => {
|
req.logout((error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`[ERROR] Error while logging out: ${error}`);
|
console.error(`[ERROR] Error while logging out: ${error}`);
|
||||||
@@ -131,11 +131,11 @@ export async function getUser(req: express.Request) {
|
|||||||
}
|
}
|
||||||
const user = (req.user as any).user;
|
const user = (req.user as any).user;
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return notConnected();
|
notConnected();
|
||||||
}
|
}
|
||||||
const model = await UserModel.findById(user.id);
|
const model = await UserModel.findById(user.id);
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return notConnected();
|
notConnected();
|
||||||
}
|
}
|
||||||
return new User(model);
|
return new User(model);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user