Skip to content

Commit

Permalink
fixed env thing
Browse files Browse the repository at this point in the history
  • Loading branch information
mddanishyusuf committed May 9, 2020
1 parent 3fc5971 commit 3a27f26
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions config/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export const GITHUB_ENDPOIINT_LOCAL = "https://api.github.com/repos/mddanishyusu

export const GITHUB_SEARCH_ENDPOIINT = "https://api.github.com/search/issues";

export const DAILYHACK_GITHUB_API = "https://api.github.com/"

export const GLITCH_ENDPOINT = "https://dailyhack.glitch.me"

export const PER_PAGE = 10
3 changes: 2 additions & 1 deletion pages/contributors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Fragment} from 'react';
import Layout from '../components/Layout';
import fetch from 'isomorphic-unfetch';
import { GLITCH_ENDPOINT} from '../config/global'

function ContributorCard(props) {
return (
Expand Down Expand Up @@ -117,7 +118,7 @@ function Contributors(props){
}

Contributors.getInitialProps = async function(){
const url = process.env.DAILYHACK_GITHUB_API + '/contributors'
const url = GLITCH_ENDPOINT + '/contributors'
const result = await fetch(url)
const data = await result.json()

Expand Down
4 changes: 2 additions & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {withRouter} from 'next/router';
import Layout from '../components/Layout';
import HackCard from '../components/HackCard';
import PaginationBox from '../components/PaginationBox';
import {PER_PAGE} from '../config/global'
import {PER_PAGE, GLITCH_ENDPOINT} from '../config/global'

const HackComponent = withRouter(props=>{
return (
Expand Down Expand Up @@ -48,7 +48,7 @@ DailyHackHome.getInitialProps = async function(context){
}else{
page_number = context.query.page_number
}
const url = process.env.DAILYHACK_GITHUB_API + '/issues/' + page_number + '/' + PER_PAGE
const url = GLITCH_ENDPOINT + '/issues/' + page_number + '/' + PER_PAGE
const result = await fetch(url)
const data = await result.json()
return {
Expand Down
3 changes: 2 additions & 1 deletion pages/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fetch from 'isomorphic-unfetch';
import Layout from '../components/Layout';
import HackCard from '../components/HackCard';
import CommentBox from '../components/CommentBox'
import {GLITCH_ENDPOINT} from '../config/global'

const SinglePost = withRouter(props => {
return(
Expand All @@ -30,7 +31,7 @@ const SinglePost = withRouter(props => {
})

SinglePost.getInitialProps = async function(context){
const result = await fetch(`${process.env.DAILYHACK_GITHUB_API}/issues/${context.query.number}`)
const result = await fetch(`${GLITCH_ENDPOINT}/issues/${context.query.number}`)
const issue = await result.json()
return {
single_issue: issue,
Expand Down
3 changes: 2 additions & 1 deletion pages/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fetch from 'isomorphic-unfetch';
import {withRouter} from 'next/router';
import getSlug from 'speakingurl'
import Link from 'next/link';
import {DAILYHACK_GITHUB_API} from '../config/global'

import Layout from '../components/Layout';

Expand Down Expand Up @@ -43,7 +44,7 @@ function DailyHackHome(props){

DailyHackHome.getInitialProps = async function(context){

const url = process.env.DAILYHACK_GITHUB_API + '/issues/1/100'
const url = DAILYHACK_GITHUB_API + '/issues/1/100'
const result = await fetch(url)
const data = await result.json()
return {
Expand Down

0 comments on commit 3a27f26

Please sign in to comment.