Commit 0dc2e45
committed
fix: check if local data is missing config data
Added a function `getLocalConfig` to retrieve everything in
browser.storage.local. According to MDN, passing a `null` or `undefined`
value retrieves the entire storage contents, so that is what I did.
Wrapped in a function for better readability and understanding.
In `saveGradesLocally`, I used the `getLocalConfig` function to get the
existing config. Then, checks are performed to see if the config values
exist, and to add them if they don't.
Before, `user_data` also erased previously stored user data. By
attempting to retrieve it from the local storage first, this prevents
that from happening.
Signed-off-by: Lucas Sta Maria <[email protected]>1 parent ef6b90e commit 0dc2e45
1 file changed
+27
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
219 | 234 | | |
220 | 235 | | |
221 | 236 | | |
222 | 237 | | |
223 | 238 | | |
224 | 239 | | |
225 | 240 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 241 | | |
235 | 242 | | |
236 | 243 | | |
237 | 244 | | |
238 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
239 | 256 | | |
240 | 257 | | |
241 | 258 | | |
| |||
0 commit comments