MOST UP TO DATE ADMIN

Merge branch 'OLFBP-858' into OLFBP-857
This commit is contained in:
Mike 2019-09-06 16:06:06 +01:00
commit 4d2ea2a1c7
6 changed files with 21 additions and 11 deletions

View File

@ -4,7 +4,12 @@ import store from '../store/modules/settings.js'
const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io' const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io'
export function fetchList(query) { export function fetchList(query) {
return axios.get(`${apiUrl}/account/search`, { params: query }) const dto = {
'page': query.page,
'limit': query.limit,
'platform': query.platform || store.state.platform
}
return axios.get(`${apiUrl}/account/search`, { params: dto })
} }
export function fetchAccount(id) { export function fetchAccount(id) {

View File

@ -1,13 +1,15 @@
import axios from 'axios' import axios from 'axios'
import store from '../store/modules/settings.js'
const TerminalEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io' const TerminalEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io'
export function fetchList(query) { export function fetchList(query) {
query.platform = store.state.platform
return axios.get(`${TerminalEndpointUrl}/terminals`, { params: query }) return axios.get(`${TerminalEndpointUrl}/terminals`, { params: query })
} }
export function fetchTerminal(id) { export function fetchTerminal(id) {
return axios.get(`${TerminalEndpointUrl}/terminal/${id}?platform=OLFDE`) return axios.get(`${TerminalEndpointUrl}/terminal/${id}?platform=${store.state.platform}`)
} }
export function createTerminal(data) { export function createTerminal(data) {
@ -23,9 +25,9 @@ export function updateTerminal(data) {
function __dataToDTO(data) { function __dataToDTO(data) {
return { return {
'name': data.name, 'name': data.name,
'platform': data.platform || 'OLFDE', 'platform': store.state.platform,
'addressLine1': data.address.addressLine1, 'addressLine1': data.address.line1,
'addressLine2': data.address.addressLine2, 'addressLine2': data.address.line2,
'county': data.address.county, 'county': data.address.county,
'country': data.address.country, 'country': data.address.country,
'postCode': data.address.postCode, 'postCode': data.address.postCode,

View File

@ -1,5 +1,6 @@
import axios from 'axios' import axios from 'axios'
import request from '@/utils/request' import request from '@/utils/request'
import store from '../store/modules/settings.js'
const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io' const apiUrl = 'https://users.service.development.therig.onlinefuelslabs.io'
@ -42,7 +43,7 @@ export function logout() {
} }
export function fetchList(query) { export function fetchList(query) {
query.platform = 'OLFDE' query.platform = store.state.platform
return axios.get(`${apiUrl}/user/search`, { params: query }) return axios.get(`${apiUrl}/user/search`, { params: query })
} }

View File

@ -223,7 +223,7 @@ export default {
}, },
getRemoteRegionList(query) { getRemoteRegionList(query) {
query = {} query = {}
query.platform = 'OLFDE' query.platform = this.$store.state.platform
query.limit = 100 query.limit = 100
fetchRegionList(query).then(response => { fetchRegionList(query).then(response => {
if (!response.data.regions) return if (!response.data.regions) return

View File

@ -61,7 +61,7 @@ export default {
created() { created() {
// Set the type for the query // Set the type for the query
this.listQuery.type = this.$route.meta.type this.listQuery.type = this.$route.meta.type
this.listQuery.platform = 'OLFDE' this.listQuery.platform = this.$store.state.platform
this.getList() this.getList()
}, },

View File

@ -166,6 +166,7 @@ export default {
if (this.isEdit) { if (this.isEdit) {
const id = this.$route.params && this.$route.params.id const id = this.$route.params && this.$route.params.id
this.fetchData(id) this.fetchData(id)
this.getRemoteAccountList()
} else { } else {
this.postForm = Object.assign({}, defaultForm) this.postForm = Object.assign({}, defaultForm)
} }
@ -226,10 +227,11 @@ export default {
} }
}) })
}, },
getRemoteAccountList(query) { getRemoteAccountList(query) { // platform is undefined
query = {} query = {}
query.platform = 'OLFDE' query.platform = this.$store.state.platform
query.limit = 100 query.limit = 100 // to fix limit maybe add another parameter in the Api call
fetchList(query).then(response => { fetchList(query).then(response => {
if (!response.data.docs) return if (!response.data.docs) return
this.accountListOptions = response.data.docs.map(v => { return { name: v.name, id: v._id } }) this.accountListOptions = response.data.docs.map(v => { return { name: v.name, id: v._id } })