@progressive-development/pd-spa-helper 0.8.1-b → 0.8.1-d
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/PdSpaHelper.d.ts.map +1 -1
- package/dist/PdSpaHelper.js +21 -17
- package/dist/router/PdRouterService.d.ts +0 -1
- package/dist/router/PdRouterService.d.ts.map +1 -1
- package/dist/router/PdRouterService.js +32 -27
- package/dist/router/rout-types.d.ts +2 -1
- package/dist/router/rout-types.d.ts.map +1 -1
- package/dist/service-provider/service-provider-impl.js +1 -9
- package/dist/store/spa-app-reducer.d.ts +9 -2
- package/dist/store/spa-app-reducer.d.ts.map +1 -1
- package/dist/store/spa-app-reducer.js +11 -4
- package/dist/store/spa-app-selector.d.ts +4 -1
- package/dist/store/spa-app-selector.d.ts.map +1 -1
- package/dist/store/spa-app-selector.js +5 -2
- package/dist/stories/routing.stories.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdSpaHelper.d.ts","sourceRoot":"","sources":["../src/PdSpaHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,cAAc,EACd,cAAc,EAEf,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"PdSpaHelper.d.ts","sourceRoot":"","sources":["../src/PdSpaHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,cAAc,EACd,cAAc,EAEf,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,8CAA8C,CAAC;AAStD,OAAO,EACL,gBAAgB,EAChB,MAAM,EAGN,cAAc,EACf,MAAM,8CAA8C,CAAC;AAItD,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,gCAAgC,CAAC;AAExC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,8BAA8B,CAAC;AAQtC,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAgD3D;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,gBAAgB,SAgCjD,CAAC;AAIF;;GAEG;AACH,8BAAsB,WAAY,SAAQ,UAAU;IAGlD,KAAK,SAAe;IAEpB;;OAEG;IAEH,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAG3B,QAAQ,EAAE,GAAG,GAAG,SAAS,CAAC;IAG1B,aAAa,EAAE,YAAY,EAAE,CAAM;IAEnC;;;OAGG;IAEH,SAAS,CAAC,MAAM,SAAM;IAEtB;;OAEG;IAEH,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAE/C;;OAEG;IAEH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAE9C;;OAEG;IAEH,OAAO,CAAC,aAAa,CAAS;IAG9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAErC,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAS;IAG7C,aAAa,CAAC,EAAE,YAAY,CAAC;IAE7B,MAAM,CAAC,MAAM,EA+EN,cAAc,CAAC;;IA0CtB,iBAAiB,IAAI,IAAI;IAmBzB,oBAAoB,IAAI,IAAI;IAM5B,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAS7B;;OAEG;IAGH;;;OAGG;IACH,oBAAoB;IA6BpB,MAAM;IAsCN,OAAO,CAAC,aAAa;IAerB,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO;IAqB3D,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO;IAsB9D,aAAa,IAAI,cAAc,GAAG,MAAM;IAkBxC,aAAa;IAcb,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,KAAK,CAAC,cAAc,CAAC;IAE7D,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAEvC,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,cAAc;IAEhD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,GAAG;IAE3C,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAEnD,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,GAAG;IAE9C,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM;IAE9D,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAkB7C,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IASnC,qBAAqB,CAAC,CAAC,EAAE,GAAG;IAW5B,uBAAuB,CAAC,CAAC,EAAE,WAAW;IAYtC,iBAAiB,CAAC,CAAC,EAAE,GAAG;IAexB,qBAAqB,CAAC,CAAC,EAAE,GAAG;IAgB5B,MAAM,CAAC,YAAY;IAUnB,gBAAgB,CAAC,EAAE,EAAE,WAAW;CAYjC"}
|
package/dist/PdSpaHelper.js
CHANGED
|
@@ -6,7 +6,7 @@ import "@progressive-development/pd-page/pd-footer";
|
|
|
6
6
|
import "@progressive-development/pd-content/pd-panel-viewer";
|
|
7
7
|
import "@progressive-development/pd-content/pd-panel";
|
|
8
8
|
import { pdStore, initializeStore } from "./store/mini-rx.store.js";
|
|
9
|
-
import { authStateChangedImpl, setServiceProvider, initAppImpl
|
|
9
|
+
import { authStateChangedImpl, setServiceProvider, initAppImpl } from "./service-provider/service-provider-impl.js";
|
|
10
10
|
import { getLoadingSelector } from "./store/spa-app-selector.js";
|
|
11
11
|
import { setRouteElement } from "./store/spa-app-effects.js";
|
|
12
12
|
import { APP_CONF_EVENT } from "./model/spa-model.js";
|
|
@@ -25,7 +25,6 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
25
25
|
if (result) __defProp(target, key, result);
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
|
-
const POST_LOGIN_REDIRECT_KEY = "postLoginRedirect";
|
|
29
28
|
const MADE_BY = {
|
|
30
29
|
txt: "made by PD Progressive Development",
|
|
31
30
|
email: "info@progressive-development.com"
|
|
@@ -41,11 +40,17 @@ const transformRoutes = () => {
|
|
|
41
40
|
name: page.name,
|
|
42
41
|
pattern: patterns,
|
|
43
42
|
auth: page.auth,
|
|
44
|
-
authFallback: page.authFallback
|
|
43
|
+
authFallback: page.authFallback
|
|
45
44
|
// optional: du kannst hier später eine `action` mit Lazy Loading ergänzen
|
|
46
45
|
};
|
|
47
46
|
routeDefs.push(routeDef);
|
|
48
47
|
});
|
|
48
|
+
routeDefs.push({
|
|
49
|
+
name: "not-found",
|
|
50
|
+
pattern: "*",
|
|
51
|
+
// für Catch-All
|
|
52
|
+
auth: false
|
|
53
|
+
});
|
|
49
54
|
return routeDefs;
|
|
50
55
|
};
|
|
51
56
|
const startInit = (config) => {
|
|
@@ -65,7 +70,6 @@ const startInit = (config) => {
|
|
|
65
70
|
}
|
|
66
71
|
navigationConfig = config.navigationConfigParam;
|
|
67
72
|
transformedRoutes = transformRoutes();
|
|
68
|
-
pdRouterService.isAuthenticatedWithSessionRedirect = isAuthenticatedWithSessionRedirect;
|
|
69
73
|
pdRouterService.configureRoutes(transformedRoutes);
|
|
70
74
|
document.dispatchEvent(new CustomEvent("init-app-event"));
|
|
71
75
|
console.log("Init done, Event created");
|
|
@@ -162,7 +166,6 @@ const _PdSpaHelper = (_a = class extends LitElement {
|
|
|
162
166
|
providerId: ((_a2 = user.providerData[0]) == null ? void 0 : _a2.providerId) ?? "firebase"
|
|
163
167
|
})
|
|
164
168
|
);
|
|
165
|
-
this._loginSuccess(new CustomEvent("login-success"));
|
|
166
169
|
} else {
|
|
167
170
|
pdStore().dispatch(nologin());
|
|
168
171
|
}
|
|
@@ -190,7 +193,7 @@ const _PdSpaHelper = (_a = class extends LitElement {
|
|
|
190
193
|
(ls) => html`<pd-loading-state .loadingState="${ls}"></pd-loading-state>`
|
|
191
194
|
)}
|
|
192
195
|
${this._renderRoutePages()}
|
|
193
|
-
${
|
|
196
|
+
${this._route === "login" ? html` <default-login
|
|
194
197
|
?active="${this._route === "login"}"
|
|
195
198
|
></default-login>` : ""}
|
|
196
199
|
</main>
|
|
@@ -274,17 +277,19 @@ const _PdSpaHelper = (_a = class extends LitElement {
|
|
|
274
277
|
`;
|
|
275
278
|
}
|
|
276
279
|
_loginSuccess(e) {
|
|
277
|
-
const redirectRoute = sessionStorage.getItem(
|
|
280
|
+
const redirectRoute = sessionStorage.getItem("postLoginRedirect");
|
|
281
|
+
if (redirectRoute) {
|
|
282
|
+
const routeToNavigate = redirectRoute && redirectRoute !== "/login" ? redirectRoute : "";
|
|
283
|
+
sessionStorage.removeItem("postLoginRedirect");
|
|
284
|
+
this.dispatchEvent(
|
|
285
|
+
new CustomEvent("route-event", {
|
|
286
|
+
detail: { route: routeToNavigate },
|
|
287
|
+
bubbles: true,
|
|
288
|
+
composed: true
|
|
289
|
+
})
|
|
290
|
+
);
|
|
291
|
+
}
|
|
278
292
|
console.debug("Login Event: ", e, window.location.href, redirectRoute);
|
|
279
|
-
const routeToNavigate = redirectRoute && redirectRoute !== "/login" ? redirectRoute : navigationConfig.defaultPostLoginRoute || "";
|
|
280
|
-
sessionStorage.removeItem(POST_LOGIN_REDIRECT_KEY);
|
|
281
|
-
this.dispatchEvent(
|
|
282
|
-
new CustomEvent("route-event", {
|
|
283
|
-
detail: { route: routeToNavigate },
|
|
284
|
-
bubbles: true,
|
|
285
|
-
composed: true
|
|
286
|
-
})
|
|
287
|
-
);
|
|
288
293
|
}
|
|
289
294
|
_localeChange(e) {
|
|
290
295
|
const newLocale = e.detail;
|
|
@@ -466,7 +471,6 @@ __decorateClass([
|
|
|
466
471
|
], _PdSpaHelper.prototype, "_selectedLocale");
|
|
467
472
|
let PdSpaHelper = _PdSpaHelper;
|
|
468
473
|
export {
|
|
469
|
-
POST_LOGIN_REDIRECT_KEY,
|
|
470
474
|
PdSpaHelper,
|
|
471
475
|
startInit
|
|
472
476
|
};
|
|
@@ -5,7 +5,6 @@ declare class PdRouterService {
|
|
|
5
5
|
private onChangeHandlers;
|
|
6
6
|
private currentRoute;
|
|
7
7
|
constructor();
|
|
8
|
-
isAuthenticatedWithSessionRedirect: (routeName: string) => Promise<boolean>;
|
|
9
8
|
/**
|
|
10
9
|
* Setzt die Routen-Konfiguration. Muss vor Verwendung von navigate() aufgerufen werden.
|
|
11
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdRouterService.d.ts","sourceRoot":"","sources":["../../src/router/PdRouterService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PdRouterService.d.ts","sourceRoot":"","sources":["../../src/router/PdRouterService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGnE,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE1D,cAAM,eAAe;IACnB,OAAO,CAAC,MAAM,CAAqC;IAEnD,OAAO,CAAC,gBAAgB,CAA4B;IAEpD,OAAO,CAAC,YAAY,CAAc;;IAQlC;;OAEG;IACI,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE;IA8DrD;;OAEG;IACU,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,UAAQ;IAejD;;OAEG;IACI,aAAa,CAAC,OAAO,EAAE,kBAAkB;IAIhD;;OAEG;YACW,OAAO;CAwDtB;AAaD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import UniversalRouter from "universal-router";
|
|
2
|
+
import { firstValueFrom, first, filter } from "rxjs";
|
|
2
3
|
import { selectAuthUser } from "../store/spa-app-selector.js";
|
|
3
4
|
import { pdStore } from "../store/mini-rx.store.js";
|
|
4
|
-
import { firstValueFrom, first } from "rxjs";
|
|
5
5
|
class PdRouterService {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.router = null;
|
|
8
8
|
this.onChangeHandlers = [];
|
|
9
9
|
this.currentRoute = "";
|
|
10
|
-
this.isAuthenticatedWithSessionRedirect = async () => true;
|
|
11
10
|
window.addEventListener("popstate", () => {
|
|
12
11
|
this.resolve(location.pathname + location.search);
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
// Default-Fallback, falls nicht überschrieben
|
|
16
14
|
/**
|
|
17
15
|
* Setzt die Routen-Konfiguration. Muss vor Verwendung von navigate() aufgerufen werden.
|
|
18
16
|
*/
|
|
@@ -21,29 +19,28 @@ class PdRouterService {
|
|
|
21
19
|
"############ CONFIGURE ROUTING SERVICE ##################",
|
|
22
20
|
definitions
|
|
23
21
|
);
|
|
24
|
-
definitions.forEach((def) => {
|
|
25
|
-
console.log(`[ROUTING] ${def.name}:`);
|
|
26
|
-
(Array.isArray(def.pattern) ? def.pattern : [def.pattern]).forEach(
|
|
27
|
-
(p, idx) => {
|
|
28
|
-
console.log(
|
|
29
|
-
` Pattern[${idx}]: "${p}" | Codes: ${[...p].map((c) => c.charCodeAt(0)).join(", ")}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
22
|
const universalRoutes = definitions.flatMap((def) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
path: pattern,
|
|
23
|
+
return {
|
|
24
|
+
path: def.pattern,
|
|
38
25
|
action: async (context) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (def.auth) {
|
|
28
|
+
let authResult;
|
|
29
|
+
if (!((_a = context.userCheck) == null ? void 0 : _a.loginCheckFinish)) {
|
|
30
|
+
authResult = await waitForFinalAuthState();
|
|
31
|
+
context.userCheck = authResult;
|
|
32
|
+
}
|
|
33
|
+
if (!((_b = context.userCheck) == null ? void 0 : _b.user)) {
|
|
34
|
+
const fallbackRoute = def.authFallback ?? "login";
|
|
35
|
+
return { redirect: fallbackRoute };
|
|
36
|
+
}
|
|
42
37
|
}
|
|
43
|
-
if (def.roles && !def.roles.some(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
if (def.roles && !def.roles.some(
|
|
39
|
+
(role) => {
|
|
40
|
+
var _a2;
|
|
41
|
+
return ((_a2 = context.userCheck.user.claims) == null ? void 0 : _a2[role]) === true;
|
|
42
|
+
}
|
|
43
|
+
)) {
|
|
47
44
|
return { redirect: "/unauthorized" };
|
|
48
45
|
}
|
|
49
46
|
if (def.action) {
|
|
@@ -57,7 +54,7 @@ class PdRouterService {
|
|
|
57
54
|
params: context.params
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
|
-
}
|
|
57
|
+
};
|
|
61
58
|
});
|
|
62
59
|
console.log("######### Universal routes: ", universalRoutes);
|
|
63
60
|
this.router = new UniversalRouter(universalRoutes);
|
|
@@ -94,16 +91,16 @@ class PdRouterService {
|
|
|
94
91
|
const pathname = url.pathname;
|
|
95
92
|
const query = Object.fromEntries(url.searchParams.entries());
|
|
96
93
|
try {
|
|
97
|
-
console.
|
|
94
|
+
console.debug(
|
|
98
95
|
"[PdRouter] bevore resolve Current location:",
|
|
99
96
|
location.pathname
|
|
100
97
|
);
|
|
101
|
-
const
|
|
98
|
+
const userCheck = await firstValueFrom(
|
|
102
99
|
pdStore().select(selectAuthUser).pipe(first())
|
|
103
100
|
);
|
|
104
101
|
const result = await this.router.resolve({
|
|
105
102
|
pathname,
|
|
106
|
-
|
|
103
|
+
userCheck
|
|
107
104
|
});
|
|
108
105
|
if (result.redirect) {
|
|
109
106
|
history.replaceState({}, "", result.redirect);
|
|
@@ -127,6 +124,14 @@ class PdRouterService {
|
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
126
|
}
|
|
127
|
+
async function waitForFinalAuthState() {
|
|
128
|
+
return await firstValueFrom(
|
|
129
|
+
pdStore().select(selectAuthUser).pipe(
|
|
130
|
+
filter((res) => res.loginCheckFinish === true),
|
|
131
|
+
first()
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
130
135
|
const pdRouterService = new PdRouterService();
|
|
131
136
|
export {
|
|
132
137
|
pdRouterService
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rout-types.d.ts","sourceRoot":"","sources":["../../src/router/rout-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"rout-types.d.ts","sourceRoot":"","sources":["../../src/router/rout-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
|
|
@@ -7,7 +7,7 @@ import { initMockResponse, callFunctionMock } from "./mock/function-client.js";
|
|
|
7
7
|
import { initFirestorage, uploadFirestorageFile, getFirestorageFileList, getFirestorageFile, downloadFileFirestorage, deleteFirestorageDocument, getFirestorageConf } from "./firebase/firestorage-client.js";
|
|
8
8
|
import { initStorageMock, uploadStorageFileMock, getMockFileList, downloadFileMock } from "./mock/storage-client.js";
|
|
9
9
|
import { prepareMessaging, activateTokenChangeHandler, registerDevice, getFirebaseMessaging } from "./firebase/messagingFirebaseClient.js";
|
|
10
|
-
import
|
|
10
|
+
import "../PdSpaHelper.js";
|
|
11
11
|
let provider;
|
|
12
12
|
let app;
|
|
13
13
|
const throwUndefinedProviderError = () => {
|
|
@@ -82,13 +82,6 @@ const isAuthenticatedImpl = () => {
|
|
|
82
82
|
}
|
|
83
83
|
return throwUndefinedProviderError();
|
|
84
84
|
};
|
|
85
|
-
const isAuthenticatedWithSessionRedirect = (routeName) => {
|
|
86
|
-
const isAuth = isAuthenticatedImpl();
|
|
87
|
-
if (!isAuth && routeName !== "login") {
|
|
88
|
-
sessionStorage.setItem(POST_LOGIN_REDIRECT_KEY, routeName);
|
|
89
|
-
}
|
|
90
|
-
return Promise.resolve(isAuth);
|
|
91
|
-
};
|
|
92
85
|
const loginImpl = (user, sec) => {
|
|
93
86
|
if (!user) {
|
|
94
87
|
const returnError = new Error("empty user");
|
|
@@ -236,7 +229,6 @@ export {
|
|
|
236
229
|
getUserIdToken,
|
|
237
230
|
initAppImpl,
|
|
238
231
|
isAuthenticatedImpl,
|
|
239
|
-
isAuthenticatedWithSessionRedirect,
|
|
240
232
|
loginImpl,
|
|
241
233
|
logoutImpl,
|
|
242
234
|
registerAppDeviceForNotification,
|
|
@@ -4,8 +4,15 @@ export interface SpaAppState {
|
|
|
4
4
|
loadingState: LoadingState[];
|
|
5
5
|
lastRoutes?: any[];
|
|
6
6
|
initIndexDB?: boolean;
|
|
7
|
-
|
|
7
|
+
userLoginDone: boolean;
|
|
8
8
|
user: AppUser | undefined;
|
|
9
9
|
}
|
|
10
|
-
export declare const spaAppReducer: import('ts-action').Reducer<
|
|
10
|
+
export declare const spaAppReducer: import('ts-action').Reducer<{
|
|
11
|
+
userLoginDone: boolean;
|
|
12
|
+
offline?: boolean;
|
|
13
|
+
loadingState: LoadingState[];
|
|
14
|
+
lastRoutes?: any[];
|
|
15
|
+
initIndexDB?: boolean;
|
|
16
|
+
user: AppUser | undefined;
|
|
17
|
+
}>;
|
|
11
18
|
//# sourceMappingURL=spa-app-reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-app-reducer.d.ts","sourceRoot":"","sources":["../../src/store/spa-app-reducer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spa-app-reducer.d.ts","sourceRoot":"","sources":["../../src/store/spa-app-reducer.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;CAC3B;AAQD,eAAO,MAAM,aAAa;;cAdd,OAAO;kBACH,YAAY,EAAE;iBACf,GAAG,EAAE;kBACJ,OAAO;UAEf,OAAO,GAAG,SAAS;EAoE1B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { reducer, on } from "ts-action";
|
|
2
|
-
import { updateInternetOffline, addLoadingState, changeSubTask, removeLoadingState, routeAction, initIndexDBSucess, loginSucess, logoutSucess } from "./spa-app-actions.js";
|
|
2
|
+
import { updateInternetOffline, addLoadingState, changeSubTask, removeLoadingState, routeAction, initIndexDBSucess, loginSucess, nologin, logoutSucess } from "./spa-app-actions.js";
|
|
3
3
|
const initialState = {
|
|
4
4
|
loadingState: [],
|
|
5
|
-
|
|
5
|
+
userLoginDone: false,
|
|
6
6
|
user: void 0
|
|
7
7
|
};
|
|
8
8
|
const spaAppReducer = reducer(
|
|
@@ -47,10 +47,17 @@ const spaAppReducer = reducer(
|
|
|
47
47
|
})),
|
|
48
48
|
on(loginSucess, (state, { payload }) => ({
|
|
49
49
|
...state,
|
|
50
|
-
|
|
50
|
+
userLoginDone: true,
|
|
51
51
|
user: payload
|
|
52
52
|
})),
|
|
53
|
-
on(
|
|
53
|
+
on(nologin, (state) => ({
|
|
54
|
+
...state,
|
|
55
|
+
userLoginDone: true
|
|
56
|
+
})),
|
|
57
|
+
on(logoutSucess, () => ({
|
|
58
|
+
...initialState,
|
|
59
|
+
userLoginDone: true
|
|
60
|
+
}))
|
|
54
61
|
);
|
|
55
62
|
export {
|
|
56
63
|
spaAppReducer
|
|
@@ -4,5 +4,8 @@ export declare const getInitStatusSelector: import('mini-rx-store/lib/selector.j
|
|
|
4
4
|
login: boolean;
|
|
5
5
|
indexedDB: boolean | undefined;
|
|
6
6
|
}>;
|
|
7
|
-
export declare const selectAuthUser: import('mini-rx-store/lib/selector.js').Selector<object,
|
|
7
|
+
export declare const selectAuthUser: import('mini-rx-store/lib/selector.js').Selector<object, {
|
|
8
|
+
user: import('../model/spa-model.js').AppUser | undefined;
|
|
9
|
+
loginCheckFinish: boolean;
|
|
10
|
+
}>;
|
|
8
11
|
//# sourceMappingURL=spa-app-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-app-selector.d.ts","sourceRoot":"","sources":["../../src/store/spa-app-selector.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,0GAuB9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,mEAG9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;EAMjC,CAAC;AAEF,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"spa-app-selector.d.ts","sourceRoot":"","sources":["../../src/store/spa-app-selector.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,0GAuB9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,mEAG9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;EAMjC,CAAC;AAEF,eAAO,MAAM,cAAc;;;EAM1B,CAAC"}
|
|
@@ -28,13 +28,16 @@ const getOfflineSelector = createSelector(
|
|
|
28
28
|
const getInitStatusSelector = createSelector(
|
|
29
29
|
getSpaAppFeatureState,
|
|
30
30
|
(state) => ({
|
|
31
|
-
login: state.
|
|
31
|
+
login: state.user !== void 0,
|
|
32
32
|
indexedDB: state.initIndexDB
|
|
33
33
|
})
|
|
34
34
|
);
|
|
35
35
|
const selectAuthUser = createSelector(
|
|
36
36
|
getSpaAppFeatureState,
|
|
37
|
-
(state) =>
|
|
37
|
+
(state) => ({
|
|
38
|
+
user: state.user,
|
|
39
|
+
loginCheckFinish: state.userLoginDone
|
|
40
|
+
})
|
|
38
41
|
);
|
|
39
42
|
export {
|
|
40
43
|
getInitStatusSelector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.stories.d.ts","sourceRoot":"","sources":["../../src/stories/routing.stories.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,OAAO,+BAA+B,CAAC;AAGvC,eAAO,MAAM,SAAS,EAAE,cAAc,EA4CrC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAe5B,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"routing.stories.d.ts","sourceRoot":"","sources":["../../src/stories/routing.stories.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,OAAO,+BAA+B,CAAC;AAGvC,eAAO,MAAM,SAAS,EAAE,cAAc,EA4CrC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAe5B,CAAC;;;;AAOF,wBAEE;AAEF,eAAO,MAAM,YAAY,4CAcxB,CAAC"}
|
package/package.json
CHANGED