Verified Commit ce5f21fe authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Dynamic retribute API endpoint

parent ac0c1838
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
<script> <script>
import sources from '@/sources' import sources from '@/sources'
import config from '@/config'
import orderBy from 'lodash/orderBy' import orderBy from 'lodash/orderBy'
import pull from 'lodash/pull' import pull from 'lodash/pull'
import chunk from 'lodash/chunk' import chunk from 'lodash/chunk'
...@@ -93,8 +94,8 @@ export default { ...@@ -93,8 +94,8 @@ export default {
let self = this let self = this
let suggestions = this.allSuggestions.filter((s) => { let suggestions = this.allSuggestions.filter((s) => {
let f = true let f = true
if (self.filters.retributeOnly) { if (self.filters.retributeOnly != null) {
f = !!this.retributeProfiles[s.fullId] f = !!this.retributeProfiles[s.fullId] === self.filters.retributeOnly
} }
return f return f
}) })
...@@ -191,7 +192,7 @@ export default { ...@@ -191,7 +192,7 @@ export default {
self.loadingRetributeProfiles.push(id) self.loadingRetributeProfiles.push(id)
}) })
const client = axios.create() const client = axios.create()
let url = `http://localhost:8000/api/v1/search/` let url = config.RetributeAPIUrl + `v1/search/`
let response let response
try { try {
response = await client.post(url, {lookups: ids}) response = await client.post(url, {lookups: ids})
...@@ -209,7 +210,7 @@ export default { ...@@ -209,7 +210,7 @@ export default {
async lookup (id) { async lookup (id) {
this.loadingRetributeProfiles.push(id) this.loadingRetributeProfiles.push(id)
const client = axios.create() const client = axios.create()
let url = `http://localhost:8000/api/v1/search/${id}` let url = config.RetributeAPIUrl + `v1/search/${id}`
try { try {
const response = await client.get(url) const response = await client.get(url)
this.$set(this.retributeProfiles, id, response.data) this.$set(this.retributeProfiles, id, response.data)
......
export default {
RetributeAPIUrl: process.env.RETRIBUTE_API_URL || 'https://api.retribute.me/'
}
const Dotenv = require('dotenv-webpack');
module.exports = {
configureWebpack: {
plugins: [
new Dotenv()
]
}
}
...@@ -2966,11 +2966,30 @@ dot-prop@^4.1.1: ...@@ -2966,11 +2966,30 @@ dot-prop@^4.1.1:
dependencies: dependencies:
is-obj "^1.0.0" is-obj "^1.0.0"
dotenv-defaults@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.0.2.tgz#441cf5f067653fca4bbdce9dd3b803f6f84c585d"
integrity sha512-iXFvHtXl/hZPiFj++1hBg4lbKwGM+t/GlvELDnRtOFdjXyWP7mubkVr+eZGWG62kdsbulXAef6v/j6kiWc/xGA==
dependencies:
dotenv "^6.2.0"
dotenv-expand@^5.1.0: dotenv-expand@^5.1.0:
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA== integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
dotenv-webpack@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1"
integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw==
dependencies:
dotenv-defaults "^1.0.2"
dotenv@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==
dotenv@^7.0.0: dotenv@^7.0.0:
version "7.0.0" version "7.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment