cancel
Showing results for 
Search instead for 
Did you mean: 

I have to use an api from the API explorer. this is the one - http://localhost/alfresco/s/api/task-instances?authority=user2&pooledTasks=true, it is asking me to enter user id and password when I am trying in post pan after entering it is working fine wit

sonu
Champ in-the-making
Champ in-the-making

here is my code, please tell me if there is any error...........i am getting empty page with loading symbol as output

export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
dataSource: null,
}
}

componentDidMount () {
return fetch('http://localhost/alfresco/s/api/task-instances?authority=user2&pooledTasks=true', {
method: 'get',
headers: new Headers({
username: "user2",
password: "password"
})
})
.then ( (response) => response.json() )
.then( (responseJson) => {

this.setState({
isLoading: false,
dataSource: responseJson.data,
})
})
.catch((error) => {
console.log(error)
});
}
render() {
if (this.state.isLoading) {
return (
<View style={styles.container}>
<ActivityIndicator />
</View>
)
} else {

let data = this.state.dataSource.map((val, key) => {
return <View key={key} style={styles.item}>
<Text>{val.title}</Text></View>
});

return (

<View style={styles.container}>
<Text>
{ id }
</Text>
</View>
);
}
}

}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center'
}
});
0 REPLIES 0