Skip to content

Instantly share code, notes, and snippets.

@lukasborawski
Last active January 25, 2018 14:40
Show Gist options
  • Save lukasborawski/dd1ef3412d83acd29fba5c4728e7fd81 to your computer and use it in GitHub Desktop.
Save lukasborawski/dd1ef3412d83acd29fba5c4728e7fd81 to your computer and use it in GitHub Desktop.

Revisions

  1. lukasborawski renamed this gist Jan 25, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. lukasborawski created this gist Jan 25, 2018.
    12 changes: 12 additions & 0 deletions Axios API Call Shorthand
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    import axios from 'axios'

    export default {
    get (path) {
    if (path.indexOf('/') !== 0) {
    path = '/' + path
    }
    return axios
    .get('//' + process.env.apiHost + ':' + process.env.apiPort + '/api' + path)
    .then(({data}) => data)
    }
    }