@etsoo/appscript 1.1.51 → 1.1.52

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.
@@ -173,6 +173,15 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
173
173
  * Refresh token
174
174
  */
175
175
  refreshToken(): Promise<boolean>;
176
+ /**
177
+ * Signout
178
+ * @param apiUrl Signout API URL
179
+ */
180
+ signout(apiUrl?: string): Promise<void>;
181
+ /**
182
+ * Go to the login page
183
+ */
184
+ toLoginPage(): void;
176
185
  /**
177
186
  * Transform URL
178
187
  * @param url URL
@@ -412,6 +421,15 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
412
421
  * Setup callback
413
422
  */
414
423
  setup(): void;
424
+ /**
425
+ * Signout
426
+ * @param apiUrl Signout API URL
427
+ */
428
+ signout(apiUrl?: string): Promise<void>;
429
+ /**
430
+ * Go to the login page
431
+ */
432
+ toLoginPage(): void;
415
433
  /**
416
434
  * Transform URL
417
435
  * @param url URL
@@ -407,6 +407,29 @@ class CoreApp {
407
407
  * Setup callback
408
408
  */
409
409
  setup() { }
410
+ /**
411
+ * Signout
412
+ * @param apiUrl Signout API URL
413
+ */
414
+ async signout(apiUrl) {
415
+ await this.api.put(apiUrl !== null && apiUrl !== void 0 ? apiUrl : 'User/Signout', undefined, {
416
+ onError: (error) => {
417
+ console.log(error);
418
+ // Prevent further processing
419
+ return false;
420
+ }
421
+ });
422
+ // Clear
423
+ this.userLogout();
424
+ // Go to login page
425
+ this.toLoginPage();
426
+ }
427
+ /**
428
+ * Go to the login page
429
+ */
430
+ toLoginPage() {
431
+ window.location.replace(this.transformUrl('/'));
432
+ }
410
433
  /**
411
434
  * Transform URL
412
435
  * @param url URL
@@ -173,6 +173,15 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
173
173
  * Refresh token
174
174
  */
175
175
  refreshToken(): Promise<boolean>;
176
+ /**
177
+ * Signout
178
+ * @param apiUrl Signout API URL
179
+ */
180
+ signout(apiUrl?: string): Promise<void>;
181
+ /**
182
+ * Go to the login page
183
+ */
184
+ toLoginPage(): void;
176
185
  /**
177
186
  * Transform URL
178
187
  * @param url URL
@@ -412,6 +421,15 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
412
421
  * Setup callback
413
422
  */
414
423
  setup(): void;
424
+ /**
425
+ * Signout
426
+ * @param apiUrl Signout API URL
427
+ */
428
+ signout(apiUrl?: string): Promise<void>;
429
+ /**
430
+ * Go to the login page
431
+ */
432
+ toLoginPage(): void;
415
433
  /**
416
434
  * Transform URL
417
435
  * @param url URL
@@ -404,6 +404,29 @@ export class CoreApp {
404
404
  * Setup callback
405
405
  */
406
406
  setup() { }
407
+ /**
408
+ * Signout
409
+ * @param apiUrl Signout API URL
410
+ */
411
+ async signout(apiUrl) {
412
+ await this.api.put(apiUrl !== null && apiUrl !== void 0 ? apiUrl : 'User/Signout', undefined, {
413
+ onError: (error) => {
414
+ console.log(error);
415
+ // Prevent further processing
416
+ return false;
417
+ }
418
+ });
419
+ // Clear
420
+ this.userLogout();
421
+ // Go to login page
422
+ this.toLoginPage();
423
+ }
424
+ /**
425
+ * Go to the login page
426
+ */
427
+ toLoginPage() {
428
+ window.location.replace(this.transformUrl('/'));
429
+ }
407
430
  /**
408
431
  * Transform URL
409
432
  * @param url URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.1.51",
3
+ "version": "1.1.52",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -234,6 +234,17 @@ export interface ICoreApp<
234
234
  */
235
235
  refreshToken(): Promise<boolean>;
236
236
 
237
+ /**
238
+ * Signout
239
+ * @param apiUrl Signout API URL
240
+ */
241
+ signout(apiUrl?: string): Promise<void>;
242
+
243
+ /**
244
+ * Go to the login page
245
+ */
246
+ toLoginPage(): void;
247
+
237
248
  /**
238
249
  * Transform URL
239
250
  * @param url URL
@@ -816,6 +827,33 @@ export abstract class CoreApp<
816
827
  */
817
828
  setup() {}
818
829
 
830
+ /**
831
+ * Signout
832
+ * @param apiUrl Signout API URL
833
+ */
834
+ async signout(apiUrl?: string) {
835
+ await this.api.put<boolean>(apiUrl ?? 'User/Signout', undefined, {
836
+ onError: (error) => {
837
+ console.log(error);
838
+ // Prevent further processing
839
+ return false;
840
+ }
841
+ });
842
+
843
+ // Clear
844
+ this.userLogout();
845
+
846
+ // Go to login page
847
+ this.toLoginPage();
848
+ }
849
+
850
+ /**
851
+ * Go to the login page
852
+ */
853
+ toLoginPage() {
854
+ window.location.replace(this.transformUrl('/'));
855
+ }
856
+
819
857
  /**
820
858
  * Transform URL
821
859
  * @param url URL