forked from nabeelio/phpvms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor all JS API calls nabeelio#360 (nabeelio#375)
* Refactor all JS API calls nabeelio#360 * Remove unused imports * Lint JS * Fix doubled api key * Formatting * Added extra logging to distance lookup * Remove the .editorconfig file in distrib * shell check fixes * Remove the .editorconfig file in distrib
- Loading branch information
Showing
39 changed files
with
1,409 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
root = true | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.php] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
# Matches the exact files either package.json or .travis.yml | ||
[{package.json, .travis.yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
'use strict'; | ||
|
||
import request from '../request'; | ||
|
||
/** | ||
* Lookup an airport from the server | ||
* | ||
* @param {String} icao | ||
*/ | ||
export default async (icao) => { | ||
let params = { | ||
method: 'GET', | ||
url: '/api/airports/' + icao + '/lookup', | ||
}; | ||
const params = { | ||
method: 'GET', | ||
url: `/api/airports/${icao}/lookup`, | ||
}; | ||
|
||
const response = await axios(params); | ||
console.log('lookup raw response: ', response); | ||
return response.data; | ||
const response = await request(params); | ||
console.log('lookup raw response: ', response); | ||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
|
||
import request from '../request'; | ||
|
||
/** | ||
* Lookup an airport from the server | ||
* | ||
* @param {String} fromICAO | ||
* @param {String} toICAO | ||
*/ | ||
export default async (fromICAO, toICAO) => { | ||
let params = { | ||
method: 'GET', | ||
url: '/api/airports/' + fromICAO + '/distance/' + toICAO, | ||
}; | ||
const params = { | ||
method: 'GET', | ||
url: `/api/airports/${fromICAO}/distance/${toICAO}`, | ||
}; | ||
|
||
const response = await axios(params); | ||
console.log('distance raw response: ', response); | ||
return response.data; | ||
const response = await request(params); | ||
console.log('distance raw response: ', response); | ||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
const base_url = document.head.querySelector('meta[name="base-url"]'); | ||
const token = document.head.querySelector('meta[name="csrf-token"]'); | ||
const api_key = document.head.querySelector('meta[name="api-key"]'); | ||
|
||
export default { | ||
api_key: api_key.content || '', | ||
base_url: base_url.content || '', | ||
csrf_token: token.content || '', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.