@intellegens/cornerstone-client 0.0.9999-alpha-4 → 0.0.9999-alpha-6
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
|
@@ -48,7 +48,7 @@ export declare class ApiInitializationService {
|
|
|
48
48
|
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
49
49
|
* @return {Promise<void>} Resolves when initialization is complete.
|
|
50
50
|
*/
|
|
51
|
-
initializeAsync({ httpService, signal }?: {
|
|
51
|
+
initializeAsync({ httpService, signal, }?: {
|
|
52
52
|
httpService?: IHttpService;
|
|
53
53
|
signal?: AbortSignal;
|
|
54
54
|
}): Promise<void>;
|
|
@@ -45,7 +45,7 @@ export class ApiInitializationService {
|
|
|
45
45
|
* @param {AbortSignal} [signal] - Optional cancellation signal
|
|
46
46
|
* @return {Promise<void>} Resolves when initialization is complete.
|
|
47
47
|
*/
|
|
48
|
-
async initializeAsync({ httpService, signal } = {}) {
|
|
48
|
+
async initializeAsync({ httpService, signal, } = {}) {
|
|
49
49
|
// Store configuration
|
|
50
50
|
if (httpService !== undefined)
|
|
51
51
|
this._httpService = httpService;
|
|
@@ -93,7 +93,7 @@ export class ApiInitializationService {
|
|
|
93
93
|
try {
|
|
94
94
|
const currentUrlResponse = await this._httpService.requestAsync(window.location.href, {
|
|
95
95
|
method: 'GET',
|
|
96
|
-
signal
|
|
96
|
+
signal,
|
|
97
97
|
});
|
|
98
98
|
const apiHeader = currentUrlResponse.headers['CORNERSTONE-API-BASEURL'] || currentUrlResponse.headers['cornerstone-api-baseurl'] || null;
|
|
99
99
|
if (apiHeader) {
|
|
@@ -112,7 +112,7 @@ export class ApiInitializationService {
|
|
|
112
112
|
try {
|
|
113
113
|
const webSettingsResponse = await this._httpService.requestAsync('./websettings.json', {
|
|
114
114
|
method: 'GET',
|
|
115
|
-
signal
|
|
115
|
+
signal,
|
|
116
116
|
});
|
|
117
117
|
if (webSettingsResponse.status === 404)
|
|
118
118
|
return (this._apiBaseUrl = undefined);
|
|
@@ -183,7 +183,7 @@ export class ApiInitializationService {
|
|
|
183
183
|
*/
|
|
184
184
|
async _getAppConfigAsync() {
|
|
185
185
|
try {
|
|
186
|
-
const response = await fetch(`${this._apiBaseUrl}/
|
|
186
|
+
const response = await fetch(`${this._apiBaseUrl}/system/init`, { credentials: 'include' });
|
|
187
187
|
if (!response.ok) {
|
|
188
188
|
throw (await response.json());
|
|
189
189
|
}
|
|
@@ -37,7 +37,14 @@ export class AuthService {
|
|
|
37
37
|
this.user = undefined;
|
|
38
38
|
return fail(await res.json());
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
const response = (await res.json());
|
|
41
|
+
if (response.ok) {
|
|
42
|
+
this.user = response.result.user;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.user = undefined;
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
41
48
|
}
|
|
42
49
|
catch (err) {
|
|
43
50
|
console.error(err);
|
|
@@ -77,7 +84,7 @@ export class AuthService {
|
|
|
77
84
|
}
|
|
78
85
|
return ok({
|
|
79
86
|
result: whoamIRes.result.user,
|
|
80
|
-
metadata: whoamIRes.metadata
|
|
87
|
+
metadata: whoamIRes.metadata,
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
catch (err) {
|