Geo Primary Verification List: Hookup API to UI
Why are we doing this work
This work will be behind feature flag geo_primary_verification_view
This work is focused on taking the UI added as as part of Geo Primary Verification List: Hookup `geo_shar... (#538023 - closed) and hooking up the API implemented as part of Geo Primary Verification API: GET `api/v4/admin... (#537707 - closed)
Relevant links
- UI issue: Geo Primary Verification List: Hookup `geo_shar... (#538023 - closed)
- API Endpoint Issue: Geo Primary Verification API: GET `api/v4/admin... (#537707 - closed)
Implementation plan
- Add
fetchModelList
toee/api/data_management_api.js
(if not created, create it and import it toee/rest_api.js
)
const DATA_MANAGEMENT_PATH = '/api/:version/data_management/:model';
export const fetchModelList = (model, options = {}) => {
const url = buildApiUrl(DATA_MANAGEMENT_PATH).replace(':model', model);
return axios.get(url, {
params: {
...options,
},
});
};
- Call
fetchModelList
fromapp.vue
on mount aftergetFiltersFromQuery
and ensure to passactiveFilters
to the query.
<script>
export default {
created() {
this.getFiltersFromQuery();
this.getModelList();
},
methods: {
async getModelList() {
try {
this.isLoading = true
const { query } = processFilters(this.activeFilters)
const { data } = await fetchModelList(this.activeModel, query);
this.modelItems = data
} catch (error) {
createAlert({
message: this.$options.i18n.modelListFetchError,
captureError: true,
error,
});
} finally {
this.isLoading = false
}
},
}
}
</script>
- Add list as raw data to template for MVC in
app.vue
<template>
<geo-list :is-loading="isLoading" :has-items="Boolean(modelItems.length)" :empty-state="emptyState">
{{ modelItems }}
</geo-list>
</template>
Edited by 🤖 GitLab Bot 🤖