mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	types: ignore db.ts
This commit is contained in:
		
							parent
							
								
									a7c12d93d3
								
							
						
					
					
						commit
						3cd4f340a1
					
				@ -18,6 +18,7 @@ class DB {
 | 
			
		||||
      new LocalStorage<Data>(`${DB.env.VITE_TITLE}-${DB.env.VITE_VERSION}`)
 | 
			
		||||
    );
 | 
			
		||||
    this.initialization();
 | 
			
		||||
    // @ts-ignore
 | 
			
		||||
    this.db.chain = chain(this.db.data);
 | 
			
		||||
  }
 | 
			
		||||
  private initialization() {
 | 
			
		||||
@ -42,8 +43,11 @@ class DB {
 | 
			
		||||
    const currentPath = `${dbName}.${user ? `user.${uuid}` : "public"}${
 | 
			
		||||
      path ? `.${path}` : ""
 | 
			
		||||
    }`;
 | 
			
		||||
    // @ts-ignore
 | 
			
		||||
    const value = this.db.chain.get(currentPath).value();
 | 
			
		||||
    // @ts-ignore
 | 
			
		||||
    if (!(value !== undefined && validator(value))) {
 | 
			
		||||
      // @ts-ignore
 | 
			
		||||
      this.db.chain.set(currentPath, defaultValue).value();
 | 
			
		||||
      this.db.write();
 | 
			
		||||
    }
 | 
			
		||||
@ -61,6 +65,7 @@ class DB {
 | 
			
		||||
      path,
 | 
			
		||||
      user
 | 
			
		||||
    });
 | 
			
		||||
    // @ts-ignore
 | 
			
		||||
    this.db.chain.set(currentPath, value).value();
 | 
			
		||||
    this.db.write();
 | 
			
		||||
  }
 | 
			
		||||
@ -77,6 +82,7 @@ class DB {
 | 
			
		||||
    defaultValue = "",
 | 
			
		||||
    user = false
 | 
			
		||||
  }): any {
 | 
			
		||||
    // @ts-ignore
 | 
			
		||||
    const values = this.db.chain
 | 
			
		||||
      .get(this.pathInit({ dbName, path, user, defaultValue }))
 | 
			
		||||
      .value();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user