add: feedbin credential verification

This commit is contained in:
Astrian Zheng 2025-06-30 15:38:17 +10:00
parent fe7d3bdd9a
commit dde32df979
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA
2 changed files with 22 additions and 4 deletions

5
app/index.tsx Normal file
View File

@ -0,0 +1,5 @@
import { Redirect } from 'expo-router';
export default function Index() {
return <Redirect href="/login" />;
}

View File

@ -1,12 +1,25 @@
import { TextInput, View, StyleSheet, Button } from 'react-native'
import { useState } from 'react'
import axios from 'axios'
export default function LoginView() {
const [email, setEmail] = useState('')
const [username, setUsername] = useState('')
const [password, setPassword] = useState('')
function login() {
console.log(email, password)
async function login() {
console.log(username, password)
try {
const res = await axios.get("https://api.feedbin.com/v2/authentication.json", {
auth: {
username,
password
}
})
console.log(res.status)
} catch(e) {
console.log("error on verifing your credentials")
console.log(e)
}
}
const styles = StyleSheet.create({
@ -22,7 +35,7 @@ export default function LoginView() {
}
})
return <View style={styles.container}>
<TextInput placeholder="Feedbin Email" style={styles.textfield} autoCapitalize="none" autoCorrect={false} textContentType="none" keyboardType="email-address" onChangeText={setEmail} />
<TextInput placeholder="Feedbin Email" style={styles.textfield} autoCapitalize="none" autoCorrect={false} textContentType="none" keyboardType="email-address" onChangeText={setUsername} />
<TextInput placeholder="Password" style={styles.textfield} secureTextEntry={true} onChangeText={setPassword} />
<Button title="Enter" onPress={login} />
</View>