/** * Sign-in URL that returns the shopper to `fullPath` afterwards. `login.vue` * only honours a same-origin absolute path, and a redirect back to the sign-in * page itself would loop, so that case drops the parameter. */ export function signInPath(fullPath: string): string { if (!fullPath.startsWith("/") || fullPath.startsWith("//") || fullPath.startsWith("/login")) { return "/login"; } return `/login?redirect=${encodeURIComponent(fullPath)}`; }