UNPKG

1.38 kBTypeScriptView Raw
1import { NbAuthToken } from './token';
2import { NbAuthTokenParceler } from './token-parceler';
3import * as i0 from "@angular/core";
4export declare abstract class NbTokenStorage {
5 abstract get(): NbAuthToken;
6 abstract set(token: NbAuthToken): any;
7 abstract clear(): any;
8}
9/**
10 * Service that uses browser localStorage as a storage.
11 *
12 * The token storage is provided into auth module the following way:
13 * ```ts
14 * { provide: NbTokenStorage, useClass: NbTokenLocalStorage },
15 * ```
16 *
17 * If you need to change the storage behaviour or provide your own - just extend your class from basic `NbTokenStorage`
18 * or `NbTokenLocalStorage` and provide in your `app.module`:
19 * ```ts
20 * { provide: NbTokenStorage, useClass: NbTokenCustomStorage },
21 * ```
22 *
23 */
24export declare class NbTokenLocalStorage extends NbTokenStorage {
25 private parceler;
26 protected key: string;
27 constructor(parceler: NbAuthTokenParceler);
28 /**
29 * Returns token from localStorage
30 * @returns {NbAuthToken}
31 */
32 get(): NbAuthToken;
33 /**
34 * Sets token to localStorage
35 * @param {NbAuthToken} token
36 */
37 set(token: NbAuthToken): void;
38 /**
39 * Clears token from localStorage
40 */
41 clear(): void;
42 static ɵfac: i0.ɵɵFactoryDeclaration<NbTokenLocalStorage, never>;
43 static ɵprov: i0.ɵɵInjectableDeclaration<NbTokenLocalStorage>;
44}