@@ -14,6 +14,10 @@ import {
14
14
IonInputPasswordToggle ,
15
15
IonLabel ,
16
16
IonPopover ,
17
+ IonCol ,
18
+ IonGrid ,
19
+ IonRow ,
20
+ IonAlert ,
17
21
} from "@ionic/react"
18
22
import { useQueryClient } from "@tanstack/react-query"
19
23
import { useAuth } from "../hooks"
@@ -47,7 +51,7 @@ const Settings: React.FC<Props> = ({ open, hasUpdate, onClose, onSave }) => {
47
51
48
52
const handleSave = ( ) => {
49
53
saveAuth ( newUsername , newPassword )
50
- queryClient . invalidateQueries ( )
54
+ queryClient . clear ( )
51
55
onSave ( )
52
56
}
53
57
@@ -57,6 +61,12 @@ const Settings: React.FC<Props> = ({ open, hasUpdate, onClose, onSave }) => {
57
61
}
58
62
}
59
63
64
+ const deleteData = ( ) => {
65
+ saveAuth ( "" , "" )
66
+ queryClient . clear ( )
67
+ window . location . reload ( )
68
+ }
69
+
60
70
const collection = queryClient . getQueryData < IReleases [ ] > ( [ `${ username } collection` ] )
61
71
const wanted = queryClient . getQueryData < IReleases [ ] > ( [ `${ username } want` ] )
62
72
const collectionMissing = collection ?. filter ( ( obj ) => obj . image_base64 === undefined ) . length ?? 0
@@ -161,6 +171,35 @@ const Settings: React.FC<Props> = ({ open, hasUpdate, onClose, onSave }) => {
161
171
For some records, we need to collect further information from the Discogs system. This can take some
162
172
time, so try reloading in a few hours to see it change.
163
173
</ IonNote >
174
+ < IonGrid >
175
+ < IonRow class = "ion-justify-content-center" >
176
+ < IonCol size = "auto" >
177
+ < IonButton onClick = { handleUpdate } color = "primary" >
178
+ Reload app
179
+ </ IonButton >
180
+ </ IonCol >
181
+ < IonCol size = "auto" >
182
+ < IonButton id = "present-alert" color = "danger" >
183
+ Remove data
184
+ </ IonButton >
185
+ </ IonCol >
186
+ </ IonRow >
187
+ </ IonGrid >
188
+ < IonAlert
189
+ header = "This will remove your account and stored data. Are you sure?"
190
+ trigger = "present-alert"
191
+ buttons = { [
192
+ {
193
+ text : "Cancel" ,
194
+ role : "cancel" ,
195
+ } ,
196
+ {
197
+ text : "Delete" ,
198
+ role : "confirm" ,
199
+ handler : deleteData ,
200
+ } ,
201
+ ] }
202
+ />
164
203
< br />
165
204
< IonNote color = "medium" class = "ion-margin-horizontal" style = { { display : "block" , textAlign : "center" } } >
166
205
Made by < a href = "https://subo.dev" > soup-bowl</ a > and{ " " }
0 commit comments