make sure CLOUD = 0 means all data is wiped
				
					
				
			This commit is contained in:
		
							parent
							
								
									309cdd4306
								
							
						
					
					
						commit
						0bb75abc81
					
				
					 1 changed files with 18 additions and 9 deletions
				
			
		|  | @ -286,17 +286,26 @@ export async function forget(preference, CLOUD = 0, override = false) { | |||
| 
 | ||||
| 	if (forget_action) { | ||||
| 		if (preference) { | ||||
| 			if (!(Array.isArray(preference))) { | ||||
| 				preference = String(preference).trim().split(","); | ||||
| 			let erase = async (CLOUD) => { | ||||
| 				if (!(Array.isArray(preference))) { | ||||
| 					preference = String(preference).trim().split(","); | ||||
| 				}; | ||||
| 				 | ||||
| 				let DATA = await read((preference.length > 1) ? [...preference.slice(0,-1)] : null, CLOUD); | ||||
| 	 | ||||
| 				if (((((typeof (DATA)).includes(`obj`) && !Array.isArray(DATA) && DATA != null) ? Object.keys(DATA) : false) ? Object.keys(DATA).includes((preference.slice(-1))[0]) : false)) { | ||||
| 					delete DATA[preference.slice(-1)]; | ||||
| 				}; | ||||
| 				 | ||||
| 				await write(preference.slice(0,-1), DATA, CLOUD); | ||||
| 			}; | ||||
| 
 | ||||
| 			let DATA = await read([...preference.slice(0,-1)], CLOUD); | ||||
| 			 | ||||
| 			if (((((typeof (DATA)).includes(`obj`) && !Array.isArray(DATA) && DATA != null) ? Object.keys(DATA) : false) ? Object.keys(DATA).includes((preference.slice(-1))[0]) : false)) { | ||||
| 				delete DATA[preference.slice(-1)]; | ||||
| 			if (CLOUD >= 0) { | ||||
| 				erase(1); | ||||
| 			}; | ||||
| 			if (CLOUD <= 0) { | ||||
| 				erase(-1); | ||||
| 			}; | ||||
| 
 | ||||
| 			await write(preference.slice(0,-1), DATA, CLOUD); | ||||
| 		} else { | ||||
| 			// Clear the data storage.
 | ||||
| 			if (CLOUD >= 0) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue