@hellocoop/react 1.0.4 → 1.2.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/logout.d.ts +2 -2
- package/dist/logout.d.ts.map +1 -1
- package/dist/logout.js +13 -3
- package/package.json +1 -1
package/dist/logout.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getLogOutRoute: () => string;
|
|
2
|
-
export declare function logOut(): void;
|
|
1
|
+
export declare const getLogOutRoute: (params: Record<string, any>) => string;
|
|
2
|
+
export declare function logOut(params: Record<string, any>): void;
|
|
3
3
|
//# sourceMappingURL=logout.d.ts.map
|
package/dist/logout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../src/logout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../src/logout.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,cAAc,WAAW,OAAO,MAAM,EAAE,GAAG,CAAC,WAA4B,CAAA;AAErF,wBAAgB,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAEhD"}
|
package/dist/logout.js
CHANGED
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logOut = exports.getLogOutRoute = void 0;
|
|
4
4
|
const provider_1 = require("./provider");
|
|
5
|
-
const
|
|
5
|
+
const makeLogoutRoute = (params) => {
|
|
6
|
+
if (!params || !Object.keys(params).length)
|
|
7
|
+
return provider_1.routeConfig.logout;
|
|
8
|
+
const logoutRoute = new URL(provider_1.routeConfig.logout, "https://example.com"); // hack so we can use URL()
|
|
9
|
+
for (let key in params) {
|
|
10
|
+
logoutRoute.searchParams.set(key, params[key]);
|
|
11
|
+
}
|
|
12
|
+
return logoutRoute.pathname + logoutRoute.search;
|
|
13
|
+
};
|
|
14
|
+
const loginRoute = new URL(provider_1.routeConfig.login, "https://example.com"); // hack so we can use URL()
|
|
15
|
+
const getLogOutRoute = (params) => makeLogoutRoute(params);
|
|
6
16
|
exports.getLogOutRoute = getLogOutRoute;
|
|
7
|
-
function logOut() {
|
|
17
|
+
function logOut(params) {
|
|
8
18
|
if (typeof window !== 'undefined')
|
|
9
|
-
window.location.href =
|
|
19
|
+
window.location.href = makeLogoutRoute(params);
|
|
10
20
|
}
|
|
11
21
|
exports.logOut = logOut;
|