@lepsto/sdk-app 87.0.1 → 87.1.0
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/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/docs/recipes/sdk-usage.md +4 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,11 +35,15 @@ function isAccessDenied(err) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/runtime/csrf.ts
|
|
38
|
-
var
|
|
38
|
+
var CSRF_COOKIES = ["lepsto_csrf", "lessly_csrf"];
|
|
39
39
|
function readCsrfCookie() {
|
|
40
40
|
if (typeof document === "undefined" || !document) return null;
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
for (const name of CSRF_COOKIES) {
|
|
42
|
+
const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));
|
|
43
|
+
const value = match ? decodeURIComponent(match[1]) : "";
|
|
44
|
+
if (value) return value;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
// src/runtime/request.ts
|
|
@@ -125,7 +129,7 @@ async function executeRequest(opts, binding, input) {
|
|
|
125
129
|
throw new LesslyApiError(
|
|
126
130
|
0,
|
|
127
131
|
"csrf_cookie_missing",
|
|
128
|
-
`CSRF cookie "lessly_csrf" is missing; the session must be re-established before mutating requests (${binding.method} ${binding.path}).`,
|
|
132
|
+
`CSRF cookie "lepsto_csrf" (or the legacy "lessly_csrf") is missing; the session must be re-established before mutating requests (${binding.method} ${binding.path}).`,
|
|
129
133
|
null
|
|
130
134
|
);
|
|
131
135
|
}
|