main
Last change
on this file since db39d9e was db39d9e, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Authorization layer
|
-
Property mode
set to
100644
|
File size:
907 bytes
|
Rev | Line | |
---|
[24819a8] | 1 | import * as React from 'react';
|
---|
| 2 | import { request } from "../axios_helper";
|
---|
| 3 |
|
---|
| 4 | export default class AuthContent extends React.Component {
|
---|
| 5 | constructor(props) {
|
---|
| 6 | super(props);
|
---|
| 7 | this.state = {
|
---|
| 8 | data: []
|
---|
| 9 | };
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | componentDidMount() {
|
---|
| 13 | request(
|
---|
| 14 | "GET",
|
---|
| 15 | "/api/restaurants",
|
---|
| 16 | []
|
---|
| 17 | ).then((response) => {
|
---|
| 18 | this.setState({ data: response.data });
|
---|
| 19 | });
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | render() {
|
---|
| 23 | return (
|
---|
| 24 | <div>
|
---|
| 25 | {this.state.data && this.state.data.map((restaurant) => (
|
---|
| 26 | <div key={restaurant.restaurantId}>
|
---|
| 27 | <p>Name: {restaurant.name}</p>
|
---|
| 28 | <p>Cuisine Type: {restaurant.cuisineType}</p>
|
---|
| 29 | <p>Address: {restaurant.address}</p>
|
---|
[db39d9e] | 30 |
|
---|
[24819a8] | 31 | </div>
|
---|
| 32 | ))}
|
---|
| 33 | </div>
|
---|
| 34 | );
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.