Sign up request
This commit is contained in:
		
							parent
							
								
									9ef748a703
								
							
						
					
					
						commit
						90bfb2e978
					
				| @ -7,16 +7,32 @@ export default class SignIn extends React.Component<any, any> { | |||||||
|     constructor(props: any) { |     constructor(props: any) { | ||||||
|         super(props); |         super(props); | ||||||
|         this.state = { |         this.state = { | ||||||
|             clips: [] |             username: '', | ||||||
|  |             password: '' | ||||||
|         } |         } | ||||||
|  |         this.updateUsername = this.updateUsername.bind(this); | ||||||
|  |         this.updatePassword = this.updatePassword.bind(this); | ||||||
|  |         this.signInFunction = this.signInFunction.bind(this); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     async signInFunction() { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     updateUsername(event: any) { | ||||||
|  |         this.setState({username: event.target.value}); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     updatePassword(event: any) { | ||||||
|  |         this.setState({password: event.target.value}); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     render(): React.ReactNode { |     render(): React.ReactNode { | ||||||
|         return ( |         return ( | ||||||
|             <View> |             <View> | ||||||
|                 <Text>Sign In</Text> |                 <Text>Sign In</Text> | ||||||
|                 <TextInput placeholder="Input" /> |                 <TextInput placeholder="Pseudo" value={this.state.username} onChange={this.updateUsername}/> | ||||||
|                 <Button title="Sign In" onPress={() => this.props.navigation.navigate('ClipList')} /> |                 <TextInput placeholder="Mot de Passe" value={this.state.password} onChange={this.updatePassword}/> | ||||||
|  |                 <Button title="Sign In" onPress={this.signInFunction} /> | ||||||
|             </View> |             </View> | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| import axios from 'axios'; |  | ||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import { View, Text, Button, TextInput } from 'react-native'; | import { View, Text, Button, TextInput } from 'react-native'; | ||||||
| 
 | 
 | ||||||
| @ -9,40 +8,43 @@ export default class SignUp extends React.Component<any, any> { | |||||||
|     constructor(props: any) { |     constructor(props: any) { | ||||||
|         super(props); |         super(props); | ||||||
|         this.state = { |         this.state = { | ||||||
|             clips: [], |  | ||||||
|             username: '', |             username: '', | ||||||
|             password: '' |             password: '' | ||||||
|         } |         } | ||||||
|         this.updateUsername = this.updateUsername.bind(this); |         this.updateUsername = this.updateUsername.bind(this); | ||||||
|         this.updatePassword = this.updatePassword.bind(this); |         this.updatePassword = this.updatePassword.bind(this); | ||||||
|         this.signIn = this.signIn.bind(this); |         this.signUpFunction = this.signUpFunction.bind(this); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async signIn() { |     async signUpFunction() { | ||||||
|         const { data, status } = await axios.put("http://notifysync.simailadjalim.fr/user", |         fetch('https://notifysync.simailadjalim.fr/user', { | ||||||
|             { email: this.state.username, password: this.state.password }); |             method: 'PUT', | ||||||
|         if (status === 200) { |             headers: { | ||||||
|             const { data, status } = await axios.post("http://notifysync.simailadjalim.fr/user", |                 Accept: 'application/json', | ||||||
|             { email: this.state.username, password: this.state.password }); |                 'Content-Type': 'application/json', | ||||||
|             this.props.navigation.navigate('ClipList'); |             }, | ||||||
|         } |             body: JSON.stringify({ | ||||||
|  |                 username: this.state.username, | ||||||
|  |                 password: this.state.password | ||||||
|  |             }), | ||||||
|  |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     updateUsername(event: any){ |     updateUsername(event: any) { | ||||||
|         this.setState({username: event.target.value}); |         this.setState({ username: event.target.value }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     updatePassword(event: any){ |     updatePassword(event: any) { | ||||||
|         this.setState({password: event.target.value}); |         this.setState({ password: event.target.value }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     render(): React.ReactNode { |     render(): React.ReactNode { | ||||||
|         return ( |         return ( | ||||||
|             <View> |             <View> | ||||||
|                 <Text>Sign Up</Text> |                 <Text>Sign Up</Text> | ||||||
|                 <TextInput placeholder="Pseudo" value={this.state.username} onChange={this.updateUsername}/> |                 <TextInput placeholder="Pseudo" value={this.state.username} onChange={this.updateUsername} /> | ||||||
|                 <TextInput placeholder="Mot de Passe" value={this.state.password} onChange={this.updatePassword}/> |                 <TextInput placeholder="Mot de Passe" value={this.state.password} onChange={this.updatePassword} /> | ||||||
|                 <Button title="Sign Up" onPress={this.signIn} /> |                 <Button title="Sign Up" onPress={this.signUpFunction} /> | ||||||
|             </View> |             </View> | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user