start chatHistory
This commit is contained in:
		
							parent
							
								
									a60cc7e941
								
							
						
					
					
						commit
						76da6aed0e
					
				
					 8 changed files with 89 additions and 38 deletions
				
			
		|  | @ -75,7 +75,7 @@ export const changePassword = async (usernameOrEmail: string, password: string, | |||
|   return await sendToDatabase(data); | ||||
| }; | ||||
| 
 | ||||
| export const getData = async (usernameOrEmail: string, password: string) => { | ||||
| export const getSettings = async (usernameOrEmail: string, password: string) => { | ||||
|   const data = { | ||||
|     action: "get_settings", | ||||
|     username: usernameOrEmail.includes('@') ? undefined : usernameOrEmail, | ||||
|  | @ -85,6 +85,38 @@ export const getData = async (usernameOrEmail: string, password: string) => { | |||
|   return await sendToDatabaseAndGetString(data); | ||||
| }; | ||||
| 
 | ||||
| export const changeSettings = async (usernameOrEmail: string, password: string, newData: object) => { | ||||
|   const data = { | ||||
|     action: "change_settings", | ||||
|     username: usernameOrEmail.includes('@') ? undefined : usernameOrEmail, | ||||
|     email: usernameOrEmail.includes('@') ? usernameOrEmail : undefined, | ||||
|     password, | ||||
|     data: newData, | ||||
|   }; | ||||
|   return await sendToDatabase(data); | ||||
| }; | ||||
| 
 | ||||
| export const getHistory = async (usernameOrEmail: string, password: string) => { | ||||
|   const data = { | ||||
|     action: "get_history", | ||||
|     username: usernameOrEmail.includes('@') ? undefined : usernameOrEmail, | ||||
|     email: usernameOrEmail.includes('@') ? usernameOrEmail : undefined, | ||||
|     password, | ||||
|   }; | ||||
|   return await sendToDatabaseAndGetString(data); | ||||
| }; | ||||
| 
 | ||||
| export const changeHistory = async (usernameOrEmail: string, password: string, newData: object) => { | ||||
|   const data = { | ||||
|     action: "change_history", | ||||
|     username: usernameOrEmail.includes('@') ? undefined : usernameOrEmail, | ||||
|     email: usernameOrEmail.includes('@') ? usernameOrEmail : undefined, | ||||
|     password, | ||||
|     data: newData, | ||||
|   }; | ||||
|   return await sendToDatabase(data); | ||||
| }; | ||||
| 
 | ||||
| export const getEmail = async (usernameOrEmail: string, password: string): Promise<string> => { | ||||
|   const data = { | ||||
|     action: "get_email", | ||||
|  | @ -105,16 +137,6 @@ export const getName = async (usernameOrEmail: string, password: string): Promis | |||
|   return await sendToDatabaseAndGetString(data); | ||||
| }; | ||||
| 
 | ||||
| export const changeData = async (usernameOrEmail: string, password: string, newData: object) => { | ||||
|   const data = { | ||||
|     action: "change_settings", | ||||
|     username: usernameOrEmail.includes('@') ? undefined : usernameOrEmail, | ||||
|     email: usernameOrEmail.includes('@') ? usernameOrEmail : undefined, | ||||
|     password, | ||||
|     data: newData, | ||||
|   }; | ||||
|   return await sendToDatabase(data); | ||||
| }; | ||||
| 
 | ||||
| export const checkCredentials = async (usernameOrEmail: string, password: string) => { | ||||
|   const data = { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue