ag-common 0.0.182 → 0.0.183

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.
@@ -3,7 +3,10 @@ export declare const LoginButton: ({ className, text, invert, savePath, loginPat
3
3
  invert?: boolean | undefined;
4
4
  text: string;
5
5
  className?: string | undefined;
6
- savePath?: boolean | undefined;
6
+ /**
7
+ * pass in request.url.path to save redirect. undefined will not set redirect
8
+ */
9
+ savePath: string | undefined;
7
10
  loginPath: (state?: Record<string, unknown> | undefined) => string;
8
11
  style?: Record<string, string | number | boolean> | undefined;
9
12
  }) => JSX.Element;
@@ -10,12 +10,13 @@ const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const Base = styled_components_1.default.a `
11
11
  ${Button_1.ButtonBase}
12
12
  `;
13
- const LoginButton = ({ className, text, invert, savePath = true, loginPath, style, }) => {
14
- const lp = loginPath(!savePath || typeof window === 'undefined'
13
+ const LoginButton = ({ className, text, invert, savePath, loginPath, style, }) => {
14
+ const state = !savePath
15
15
  ? undefined
16
16
  : {
17
- redirect: window.location.href.substring(window.location.origin.length),
18
- });
17
+ redirect: savePath,
18
+ };
19
+ const lp = loginPath(state);
19
20
  return (react_1.default.createElement(Base, { style: style, href: lp, title: text, "data-invert": invert, "data-disabled": false, className: className }, text));
20
21
  };
21
22
  exports.LoginButton = LoginButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.182",
3
+ "version": "0.0.183",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",