|
@@ -1,5 +1,5 @@
|
|
import { ApiError } from "../exceptions/api-error.js";
|
|
import { ApiError } from "../exceptions/api-error.js";
|
|
-import tokenService from "#modules/users/auth/services/token-service.js";
|
|
|
|
|
|
+import tokenService from "#modules/client/users/auth/services/token-service.js";
|
|
import type { NextFunction, Request, Response } from "express";
|
|
import type { NextFunction, Request, Response } from "express";
|
|
import { logger } from "#plugins/logger.js";
|
|
import { logger } from "#plugins/logger.js";
|
|
|
|
|
|
@@ -8,16 +8,11 @@ export default function () {
|
|
try {
|
|
try {
|
|
// авторизация
|
|
// авторизация
|
|
const authorizationHeader = req.headers.authorization;
|
|
const authorizationHeader = req.headers.authorization;
|
|
- const eventCode = req.headers["event-code"];
|
|
|
|
|
|
|
|
if (!authorizationHeader) {
|
|
if (!authorizationHeader) {
|
|
return next(ApiError.UnauthorizedError());
|
|
return next(ApiError.UnauthorizedError());
|
|
}
|
|
}
|
|
|
|
|
|
- if (!eventCode || typeof eventCode !== "string") {
|
|
|
|
- return next(ApiError.BadRequest("neEventCode", "event-code не указан"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
const accessToken = authorizationHeader.split(" ")[1];
|
|
const accessToken = authorizationHeader.split(" ")[1];
|
|
if (!accessToken) {
|
|
if (!accessToken) {
|
|
return next(ApiError.UnauthorizedError());
|
|
return next(ApiError.UnauthorizedError());
|
|
@@ -29,7 +24,6 @@ export default function () {
|
|
}
|
|
}
|
|
|
|
|
|
req.user = userData;
|
|
req.user = userData;
|
|
- req.eventCode = eventCode;
|
|
|
|
|
|
|
|
next();
|
|
next();
|
|
} catch (e) {
|
|
} catch (e) {
|