Advertisement
enkf

Untitled

Jan 10th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {StyleSheet, View, Text, TextInput, AsyncStorage, Image } from 'react-native';
  3. import { Button,CardItem } from 'native-base'
  4. import Axios from 'axios';
  5.  
  6.  
  7.  
  8. class Promotions extends Component {
  9. constructor(props) {
  10. super(props);
  11. this.state = {
  12. // // treatement_id= '',
  13. // title= '',
  14. // desc= '',
  15. // image='',
  16. // token= ''
  17. }
  18. }
  19.  
  20. async componentDidMount() {
  21. const token = await AsyncStorage.getItem('token')
  22. Axios({
  23. method: 'get',
  24. url: 'http://192.168.56.1/vzuu/public/api/promotions',
  25.  
  26. dataType: 'json',
  27. headers: {
  28. 'Accept' : 'application/json',
  29. 'Content-Type': 'application/json',
  30. 'Authorization': 'Bearer ' + token,
  31. },
  32. })
  33. .then(function (response) {
  34. console.log(response.data);
  35. })
  36. .catch(function(error) {
  37. console.log(error);
  38. })
  39. }
  40.  
  41. render() {
  42. return(
  43. <View>
  44. <CardItem>
  45. <Image />
  46. </CardItem>
  47. <CardItem>
  48. <Text />
  49. </CardItem>
  50. </View>
  51. )
  52. }
  53. }
  54.  
  55. export default Promotions;
  56. const styles = StyleSheet.create({
  57. container: {
  58. flex: 1,
  59. justifyContent: 'center',
  60. alignItems: 'center'
  61. },
  62. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement