@hellocoop/express 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/handlers/auth.js +2 -2
- package/dist/handlers/router.js +2 -2
- package/package.json +4 -3
package/dist/handlers/auth.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateAuth = exports.setAuthMiddleware = exports.clearAuth = exports.handleAuth = void 0;
|
|
4
4
|
const auth_1 = require("../lib/auth");
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("@hellocoop/constants");
|
|
6
6
|
const handleAuth = async function (req, res) {
|
|
7
7
|
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
|
8
8
|
res.setHeader('Pragma', 'no-cache');
|
|
@@ -19,7 +19,7 @@ const setAuthMiddleware = async function (req, res, next) {
|
|
|
19
19
|
req.getAuth = async () => {
|
|
20
20
|
if (req.auth)
|
|
21
21
|
return req.auth;
|
|
22
|
-
req.auth = await (0, auth_1.getAuthfromCookies)(req, res) ||
|
|
22
|
+
req.auth = await (0, auth_1.getAuthfromCookies)(req, res) || constants_1.NotLoggedIn;
|
|
23
23
|
return req.auth;
|
|
24
24
|
};
|
|
25
25
|
res.clearAuth = async () => {
|
package/dist/handlers/router.js
CHANGED
|
@@ -9,7 +9,7 @@ const login_1 = __importDefault(require("./login"));
|
|
|
9
9
|
const logout_1 = __importDefault(require("./logout"));
|
|
10
10
|
const wildcard_1 = __importDefault(require("./wildcard"));
|
|
11
11
|
const auth_1 = require("./auth");
|
|
12
|
-
const
|
|
12
|
+
const constants_1 = require("@hellocoop/constants");
|
|
13
13
|
// const translateHandlerErrors = (handler: Router): Router =>
|
|
14
14
|
// async (req: Request, res: Response, next: NextFunction) => {
|
|
15
15
|
// try {
|
|
@@ -28,7 +28,7 @@ const router = (req, res) => {
|
|
|
28
28
|
const { query } = req;
|
|
29
29
|
if (query.auth || query.getAuth) { // get auth object
|
|
30
30
|
if (config_1.default.error) {
|
|
31
|
-
return res.end(
|
|
31
|
+
return res.end(constants_1.NotLoggedIn);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
return (0, auth_1.handleAuth)(req, res);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellocoop/express",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Express SDK for Hellō https://hello.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"express": "^4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@hellocoop/types": "*",
|
|
47
48
|
"@tsconfig/node18": "^18.2.2",
|
|
48
49
|
"@types/cookie": "^0.5.2",
|
|
49
50
|
"@types/express": "^4.17.20",
|
|
@@ -55,8 +56,8 @@
|
|
|
55
56
|
"node": ">=18"
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
|
-
"@hellocoop/core": "
|
|
59
|
-
"@hellocoop/
|
|
59
|
+
"@hellocoop/core": "*",
|
|
60
|
+
"@hellocoop/constants": "*",
|
|
60
61
|
"cookie": "^0.5.0",
|
|
61
62
|
"cors": "^2.8.5",
|
|
62
63
|
"dotenv": "^16.3.1"
|