@scm-manager/ui-api 2.30.2-20220028-150554 → 2.30.2-20220101-144856

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-api",
3
- "version": "2.30.2-20220028-150554",
3
+ "version": "2.30.2-20220101-144856",
4
4
  "description": "React hook api for the SCM-Manager backend",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "react-test-renderer": "^17.0.1"
26
26
  },
27
27
  "dependencies": {
28
- "@scm-manager/ui-types": "^2.30.2-20220028-150554",
28
+ "@scm-manager/ui-types": "^2.30.2-20220101-144856",
29
29
  "fetch-mock-jest": "^1.5.1",
30
30
  "gitdiff-parser": "^0.1.2",
31
31
  "query-string": "6.14.1",
@@ -28,6 +28,16 @@ import { useMutation, useQuery, useQueryClient } from "react-query";
28
28
  import { apiClient } from "./apiclient";
29
29
  import { useLocation } from "react-router-dom";
30
30
 
31
+ const appendQueryParam = (link: Link, name: string, value: string) => {
32
+ let href = link.href;
33
+ if (href.includes("?")) {
34
+ href += "&";
35
+ } else {
36
+ href += "?";
37
+ }
38
+ link.href = href + name + "=" + value;
39
+ };
40
+
31
41
  export const usePluginCenterAuthInfo = (): ApiResult<PluginCenterAuthenticationInfo> => {
32
42
  const link = useIndexLink("pluginCenterAuth");
33
43
  const location = useLocation();
@@ -42,7 +52,10 @@ export const usePluginCenterAuthInfo = (): ApiResult<PluginCenterAuthenticationI
42
52
  .then(response => response.json())
43
53
  .then((result: PluginCenterAuthenticationInfo) => {
44
54
  if (result._links?.login) {
45
- (result._links.login as Link).href += `?source=${location.pathname}`;
55
+ appendQueryParam(result._links.login as Link, "source", location.pathname);
56
+ }
57
+ if (result._links?.reconnect) {
58
+ appendQueryParam(result._links.reconnect as Link, "source", location.pathname);
46
59
  }
47
60
  return result;
48
61
  });