cauthy-auth 0.23.0 → 0.24.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/vue.mjs CHANGED
@@ -77,6 +77,13 @@ function ceremonyError(e) {
77
77
  return { code: "passkey_failed", message: "The passkey could not be used. Try again, or sign in another way." };
78
78
  }
79
79
 
80
+ // src/url.ts
81
+ function withoutTrailingSlashes(s) {
82
+ let end = s.length;
83
+ while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
84
+ return s.slice(0, end);
85
+ }
86
+
80
87
  // src/theme.ts
81
88
  function fromWire(wire) {
82
89
  const names = {
@@ -171,7 +178,7 @@ function loadGoogleIdentity() {
171
178
  var PASSKEY_SECONDS = 300;
172
179
  var UNAVAILABLE = { code: "unavailable", message: "Sign-in is unavailable right now. Try again in a moment." };
173
180
  function createAuthClient(options = {}) {
174
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
181
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
175
182
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
176
183
  const locale = () => {
177
184
  const said = typeof options.locale === "function" ? options.locale() : options.locale;
@@ -464,7 +471,7 @@ function createAuthClient(options = {}) {
464
471
  // src/store.ts
465
472
  var AHEAD_MS = 6e4;
466
473
  function createSessionStore(options = {}) {
467
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
474
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
468
475
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
469
476
  const first = options.initialSession;
470
477
  let state = { session: first ?? null, status: first === void 0 ? "loading" : first === null ? "unauthenticated" : "authenticated" };