@enfyra/sdk-nuxt 0.6.1 → 0.6.3
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/module.json +1 -1
- package/dist/runtime/server/api/all.d.ts.map +1 -1
- package/dist/runtime/server/api/all.js +11 -1
- package/dist/runtime/server/api/login.post.d.ts.map +1 -1
- package/dist/runtime/server/api/login.post.js +4 -2
- package/package.json +1 -1
- package/src/runtime/server/api/all.ts +14 -1
- package/src/runtime/server/api/login.post.ts +4 -3
package/dist/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../../src/runtime/server/api/all.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../../src/runtime/server/api/all.ts"],"names":[],"mappings":";AAUA,wBAQG"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, setResponseHeaders } from "h3";
|
|
2
2
|
import { proxyToAPI } from "../../utils/server/proxy.js";
|
|
3
|
+
const CORS_HEADERS = {
|
|
4
|
+
"Access-Control-Allow-Origin": "*",
|
|
5
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
6
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
|
7
|
+
"Access-Control-Max-Age": "86400"
|
|
8
|
+
};
|
|
3
9
|
export default defineEventHandler(async (event) => {
|
|
10
|
+
setResponseHeaders(event, CORS_HEADERS);
|
|
11
|
+
if (event.method === "OPTIONS") {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
4
14
|
return proxyToAPI(event);
|
|
5
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.post.d.ts","sourceRoot":"","sources":["../../../../src/runtime/server/api/login.post.ts"],"names":[],"mappings":";;;AAiBA,
|
|
1
|
+
{"version":3,"file":"login.post.d.ts","sourceRoot":"","sources":["../../../../src/runtime/server/api/login.post.ts"],"names":[],"mappings":";;;AAiBA,wBAsDG"}
|
|
@@ -43,8 +43,10 @@ export default defineEventHandler(async (event) => {
|
|
|
43
43
|
let errorMessage = "Authentication failed";
|
|
44
44
|
let errorCode = "AUTHENTICATION_ERROR";
|
|
45
45
|
if (errorData?.error) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const msg = errorData.error.message || errorData.message;
|
|
47
|
+
errorMessage = typeof msg === "string" ? msg : errorMessage;
|
|
48
|
+
const code = errorData.error.code;
|
|
49
|
+
errorCode = typeof code === "string" ? code : errorCode;
|
|
48
50
|
}
|
|
49
51
|
return sendError(
|
|
50
52
|
event,
|
package/package.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, setResponseHeaders } from "h3";
|
|
2
2
|
import { proxyToAPI } from "../../utils/server/proxy";
|
|
3
3
|
|
|
4
|
+
const CORS_HEADERS = {
|
|
5
|
+
'Access-Control-Allow-Origin': '*',
|
|
6
|
+
'Access-Control-Allow-Methods': 'GET, POST, PUT, PATCH, DELETE, OPTIONS',
|
|
7
|
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
|
8
|
+
'Access-Control-Max-Age': '86400',
|
|
9
|
+
};
|
|
10
|
+
|
|
4
11
|
export default defineEventHandler(async (event) => {
|
|
12
|
+
setResponseHeaders(event, CORS_HEADERS);
|
|
13
|
+
|
|
14
|
+
if (event.method === 'OPTIONS') {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
return proxyToAPI(event);
|
|
6
19
|
});
|
|
@@ -50,9 +50,10 @@ export default defineEventHandler(async (event) => {
|
|
|
50
50
|
let errorCode = "AUTHENTICATION_ERROR";
|
|
51
51
|
|
|
52
52
|
if (errorData?.error) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const msg = errorData.error.message || errorData.message;
|
|
54
|
+
errorMessage = typeof msg === "string" ? msg : errorMessage;
|
|
55
|
+
const code = errorData.error.code;
|
|
56
|
+
errorCode = typeof code === "string" ? code : errorCode;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
return sendError(
|