File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,22 @@ <h3 class="ink-page-title mb-5">
4
4
< i class ="ink-icon icon-settings "> </ i > Settings</ h3 >
5
5
< inkapp-settings-item >
6
6
< div class ="description ">
7
- < h5 > Export complete database</ h5 >
7
+ < h5 > Export database</ h5 >
8
8
< p > JSON file with all necessary information to import</ p >
9
9
</ div >
10
10
< div class ="action ">
11
11
< button class ="btn btn-primary " routerLink ="/export "> Export</ button >
12
12
</ div >
13
13
</ inkapp-settings-item >
14
+
15
+ < inkapp-settings-item >
16
+ < div class ="description ">
17
+ < h5 > Delete app data</ h5 >
18
+ < p > Will clear all data and reset to initial</ p >
19
+ </ div >
20
+ < div class ="action ">
21
+ < button class ="btn btn-danger " (click) ="deleteDatabase() "> delete</ button >
22
+ </ div >
23
+ </ inkapp-settings-item >
14
24
</ div >
15
25
</ div >
Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
+ import { LocalDatabase } from '../../services/localdb.service' ;
2
3
3
4
@Component ( {
4
5
selector : 'inkapp-settings-page' ,
5
6
templateUrl : './settings.component.html' ,
6
7
styles : [ ]
7
8
} )
8
9
export class SettingsPage implements OnInit {
9
- constructor ( ) { }
10
+ constructor ( private _localDatabase : LocalDatabase ) { }
10
11
11
12
ngOnInit ( ) { }
13
+ deleteDatabase ( ) {
14
+ this . _localDatabase . deleteDatabase ( ) ;
15
+ }
12
16
}
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ export class LocalDatabase {
62
62
return LocalDatabase . DbConn ;
63
63
}
64
64
65
+ async deleteDatabase ( ) {
66
+ const db = await this . getDatabase ( ) ;
67
+ return db . remove ( ) ;
68
+ }
69
+
65
70
private setupDatabase ( ) : Promise < any > {
66
71
return RxDB . create ( DatabaseSettings )
67
72
. then ( async ( db : InkDb ) => {
You can’t perform that action at this time.
0 commit comments