main
Last change
on this file since 8ca35dc was 8ca35dc, checked in by Aleksandar Panovski <apano77@…>, 6 months ago |
Done with stupid timeslots
|
-
Property mode
set to
100644
|
File size:
946 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>
|
---|
[8ca35dc] | 30 | <p>User: {}</p>
|
---|
[24819a8] | 31 | </div>
|
---|
| 32 | ))}
|
---|
| 33 | </div>
|
---|
| 34 | );
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.