antcalatayud / ReactCoin (public) (License: GPLv3) (since 2018-04-24) (hash sha1)
As seen on this course: https://udilia.com/courses/learn-react-by-building-a-web-app
List of commits:
Subject Hash Author Date (UTC)
Move some conts outside 00686f6d20dcc806e20a3d7bfb745517c203dd54 antcalatayud 2018-04-24 13:00:43
Add AJAX request to list component 3dd5f784d209cc1cfeb22bbc93aaf2c871e2c69b antcalatayud 2018-04-24 12:29:22
Start creating list componet c8bc3d6bb9b4980e1305d401be2fe67c8933a7f8 antcalatayud 2018-04-24 10:31:23
Add logo eed8364675e78cfa795550bff03682d49a8ed115 antcalatayud 2018-04-24 10:23:07
Add styling 866cbbbc94ce81e8b8b6b88da9f86d2d4153e509 antcalatayud 2018-04-24 10:18:43
Create fist component and render App b713ed055b8691a0fd89792d136e0ef9ed86f07c antcalatayud 2018-04-24 10:11:22
Add init files d81df9e3d230bcb49f0bb31c43cffad97532d321 antcalatayud 2018-04-24 09:51:04
Initial commit 3c3626d89f221374c92ee04aed1eaa8616f3977e Antonio Calatayud 2018-04-24 09:03:03
Commit 00686f6d20dcc806e20a3d7bfb745517c203dd54 - Move some conts outside
Author: antcalatayud
Author date (UTC): 2018-04-24 13:00
Committer name: antcalatayud
Committer date (UTC): 2018-04-24 13:00
Parent(s): 3dd5f784d209cc1cfeb22bbc93aaf2c871e2c69b
Signing key:
Tree: 0a5d19327ac4a6e408dcb593c6715c10d60b1d99
File Lines added Lines deleted
src/components/list/List.js 4 6
src/config.js 4 0
src/helpers.js 13 0
File src/components/list/List.js changed (mode: 100644) (index eb63e0f..b98eaad)
1 1 import React from 'react'; import React from 'react';
2 import { handleResponse } from '../../helpers';
3 import { API_URL } from '../../config'
2 4
3 5 class List extends React.Component { class List extends React.Component {
4 6 constructor(props) { constructor(props) {
 
... ... class List extends React.Component {
14 16 componentDidMount(){ componentDidMount(){
15 17 this.setState({ loading: true }); this.setState({ loading: true });
16 18
17 fetch('https://api.udilia.com/coins/v1/cryptocurrencies?page=1&perPage=20')
18 .then(response => {
19 return response.json().then(json => {
20 return response.ok ? json : Promise.reject(json);
21 });
22 })
19 fetch(`${API_URL}/cryptocurrencies?page=1&perPage=20`)
20 .then(handleResponse)
23 21 .then((data) => { .then((data) => {
24 22 this.setState({ this.setState({
25 23 loading: false, loading: false,
File src/config.js added (mode: 100644) (index 0000000..5b268e5)
1 /**
2 * API root url
3 */
4 export const API_URL = 'https://api.udilia.com/coins/v1';
File src/helpers.js added (mode: 100644) (index 0000000..25b2340)
1 /**
2 |--------------------------------------------------
3 | Fetch error helper
4 |
5 | @param {object} response
6 |--------------------------------------------------
7 */
8
9 export const handleResponse = (response) => {
10 return response.json().then(json => {
11 return response.ok ? json : Promise.reject(json);
12 });
13 };
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/antcalatayud/ReactCoin

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/antcalatayud/ReactCoin

Clone this repository using git:
git clone git://git.rocketgit.com/user/antcalatayud/ReactCoin

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main