Skip to content

Instantly share code, notes, and snippets.

View theSekyi's full-sized avatar

Emmanuel Sekyi theSekyi

View GitHub Profile
let navOld = axios.get(newNavUrl).then(function(response) {
return response.data.payload.nav;
});
console.log(navOld);
let Dailyrate = fetch(oldNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
return data.payload.nav;
})
.catch();
console.log(Dailyrate);
let newNavDaily = () =>
fetch(oldNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
let nav = data.payload.nav;
return nav;
});
newNavDaily().then(console.log);
let newNavDaily = () =>
fetch(newNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
let newNav = data.payload.nav;
return newNav;
});
let ournewNav = newNavDaily().then(res => (nav = res));
let newNavDaily = () =>
fetch(newNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
let newNav = data.payload.nav;
return newNav;
});
newNavDaily().then(console.log);
let oldNavDaily = () =>
fetch(oldNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
let oldNav = data.payload.nav;
return oldNav;
});
oldNavDaily().then(console.log);
@theSekyi
theSekyi / nasda.js
Last active January 25, 2018 11:17
let cNew = newNav => {
return newNav;
};
let newNavDaily = () =>
fetch(newNavUrl)
.then(resp => {
return resp.json();
})
.then(data => {
import React from 'react';
import Nav from './Nav';
import ProjectionsHeader from './projectionsHeader';
import Chart from './chart';
import cookie from 'react-cookies';
import axios from 'axios';
class Projections extends React.Component {
constructor() {
super();
import React from 'react';
import Nav from './Nav';
import ProjectionsHeader from './projectionsHeader';
import Chart from './chart';
import cookie from 'react-cookies';
import axios from 'axios';
class Projections extends React.Component {
constructor() {
super();
//get date in the dd-mm-yyyy format to fetch data from api
this.currentYear = new Date().getFullYear();
this.currentDate = new Date();
this.currentMonth = this.currentDate.getUTCMonth() + 1;
this.currentDay = this.currentDate.getUTCDate();
this.oldDay = this.currentDay - 2;
this.newDay = this.currentDay - 1;
if (this.currentMonth < 10) {
this.currentMonth = '0' + this.currentMonth;
}