@gandalan/weblibs 0.0.16 → 0.0.19

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.
Files changed (2) hide show
  1. package/api/IDAS.js +11 -19
  2. package/package.json +1 -1
package/api/IDAS.js CHANGED
@@ -1,25 +1,13 @@
1
1
  import { RESTClient } from "./RESTClient";
2
2
 
3
- /*if (window.location.search) {
4
- var urlParams = new URLSearchParams(location.search);
5
- if (urlParams.has("t"))
6
- localStorage.setItem("IDAS_AuthToken", urlParams.get("t"));
7
- if (urlParams.has("m"))
8
- localStorage.setItem("IDAS_MandantGuid", urlParams.get("m"));
9
- if (urlParams.has("a"))
10
- localStorage.setItem("IDAS_ApiBaseUrl", urlParams.get("a"));
11
- window.location = window.location.origin;
12
- }*/
13
-
14
3
  let appToken = localStorage.getItem("IDAS_AppToken") || "66B70E0B-F7C4-4829-B12A-18AD309E3970";
15
4
  let authToken = localStorage.getItem("IDAS_AuthToken");
16
- //let mandantGuid = localStorage.getItem("IDAS_MandantGuid");
17
5
  let apiBaseUrl = localStorage.getItem("IDAS_ApiBaseUrl") || "https://api.dev.idas-cloudservices.net/api/";
18
- //let siteBaseUrl = localStorage.getItem("SiteBaseUrl") || window.location.protocol + "//" + window.location.host;
19
6
 
20
- let ssoAuthUrl = apiBaseUrl + "/SSO?a=" + appToken + "&r=%target%%3Ft=%token%%26m=%mandant%";
21
- ssoAuthUrl = ssoAuthUrl.replace('/api/', '/');
22
- ssoAuthUrl = ssoAuthUrl.replace('//', '/');
7
+ const url = new URL(apiBaseUrl);
8
+ url.pathname = "/SSO";
9
+ url.search = "?a=" + appToken + "&r=%target%%3Ft=%token%%26m=%mandant%";
10
+ let ssoAuthUrl = url.toString();
23
11
 
24
12
  let restClient = new RESTClient(apiBaseUrl, authToken);
25
13
  restClient.onError = (error, message) => {
@@ -27,7 +15,7 @@ restClient.onError = (error, message) => {
27
15
  {
28
16
  //console.log(message+" would remove Token");
29
17
  localStorage.removeItem("IDAS_AuthToken");
30
- var ssoURL = ssoAuthUrl.replace("%target%", window.location.origin);
18
+ var ssoURL = ssoAuthUrl.replace("%target%", encodeURIComponent(window.location.href));
31
19
  window.location = ssoURL;
32
20
  }
33
21
  }
@@ -50,13 +38,17 @@ export class IDAS
50
38
  async authenticateWithSSO() {
51
39
  if (!authToken)
52
40
  {
53
- var ssoURL = ssoAuthUrl.replace("%target%", window.location.origin);
41
+ var ssoURL = ssoAuthUrl.replace("%target%", encodeURIComponent(window.location.href));
54
42
  window.location = ssoURL;
55
43
  }
56
44
  }
57
45
 
58
46
  mandantGuid = localStorage.getItem("IDAS_MandantGuid");
59
47
 
48
+ auth = {
49
+ async getCurrentAuthToken() { return await restClient.put("/Login/Update/", { Token: authToken }); },
50
+ };
51
+
60
52
  mandanten = {
61
53
  async getAll() { return await restClient.get("/Mandanten"); },
62
54
  async get(guid) { return await restClient.get("/Mandanten/" + guid); },
@@ -73,7 +65,7 @@ export class IDAS
73
65
  async getAll() { return await restClient.get("/Feedback/"); },
74
66
  async get(guid) { return await restClient.get("/Feedback/" + guid); },
75
67
  async save(m) { await restClient.put("/Feedback", m); },
76
- async comment(m) { await restClient.put("/FeedbackKommentar", m); },
68
+ async comment(guid, commentData) { await restClient.put("/FeedbackKommentar/" + guid, commentData); },
77
69
  async attachFile(m) { await restClient.put("/FeedbackAttachment", m); },
78
70
  async deleteFile(guid) { await restClient.delete("/FeedbackAttachment/" + guid); }
79
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "author": "Philipp Reif",
6
6
  "license": "ISC",