This commit is contained in:
2019-01-04 21:45:46 +00:00
parent 5e13a107be
commit c86dd91d33
7 changed files with 16 additions and 41 deletions

View File

@@ -47,7 +47,7 @@
</template> </template>
<script> <script>
import aboutInfo from "./utils/aboutinfo"; import aboutInfo from "./api/aboutinfo";
export default { export default {
name: "App", name: "App",

View File

@@ -160,7 +160,7 @@ export default {
); );
}, },
get(route) { get(route) {
var that=this; var that = this;
//debugger; //debugger;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
//debugger; //debugger;
@@ -169,12 +169,12 @@ export default {
.then(that.json) .then(that.json)
.then(response => { .then(response => {
//For now, assuming that all returns that make it here have either an error or a data object attached to them //For now, assuming that all returns that make it here have either an error or a data object attached to them
//debugger; // debugger;
resolve(response); resolve(response);
}) })
.catch(function(error) { .catch(function(error) {
//fundamental error, can't proceed with this call //fundamental error, can't proceed with this call
// debugger; //debugger;
var errorMessage = var errorMessage =
"API error: GET route =" + route + ", message =" + error.message; "API error: GET route =" + route + ", message =" + error.message;
store.commit("logItem", errorMessage); store.commit("logItem", errorMessage);
@@ -183,4 +183,6 @@ export default {
}); });
}); });
} }
//new functions above here
}; };

View File

@@ -1,29 +0,0 @@
/* xeslint-disable */
import apiUtil from "./apiutil";
export default {
fetch(route, listOptions) {
// listOptions;
// var futureWithSortExampleListOptions = {
// offset: 5,
// limit: 5,
// sortBy: "name",
// descending: false
// };
// exampleListOptions;
var listUrl = route + "?" + apiUtil.buildQuery(listOptions);
return new Promise(function(resolve, reject) {
fetch(apiUtil.APIUrl(listUrl), apiUtil.fetchGetOptions())
.then(apiUtil.status)
.then(apiUtil.json)
.then(response => {
resolve(response);
})
.catch(function(error) {
reject(error);
});
});
}
};

View File

@@ -52,9 +52,9 @@
<script> <script>
/* eslint-disable */ /* xeslint-disable */
import localeText from "../api/locale"; import localeText from "../api/locale";
import pagedList from "../api/pagedlist"; import api from "../api/apiutil";
import WidgetEdit from "../components/inventorywidgetedit"; import WidgetEdit from "../components/inventorywidgetedit";
export default { export default {
ltKeysRequired: [ ltKeysRequired: [
@@ -118,7 +118,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.rowsPerPageText = lt("RowsPerPage"); this.rowsPerPageText = this.lt("RowsPerPage");
this.getDataFromApi(); this.getDataFromApi();
}, },
computed: {}, computed: {},
@@ -136,7 +136,7 @@ export default {
offset: 0, offset: 0,
limit: 5, limit: 5,
sort: "name", sort: "name",
asc:true asc: true
}; };
if (this.pagination.rowsPerPage && this.pagination.rowsPerPage > 0) { if (this.pagination.rowsPerPage && this.pagination.rowsPerPage > 0) {
@@ -145,10 +145,12 @@ export default {
listOptions.limit = this.pagination.rowsPerPage; listOptions.limit = this.pagination.rowsPerPage;
} }
listOptions.sort = this.pagination.sortBy; listOptions.sort = this.pagination.sortBy;
listOptions.asc=!this.pagination.descending; listOptions.asc = !this.pagination.descending;
this.loading = true; this.loading = true;
pagedList.fetch("Widget/ListWidgets", listOptions).then(res => { //debugger;
var listUrl = "Widget/ListWidgets?" + api.buildQuery(listOptions);
api.get(listUrl).then(res => {
// debugger; // debugger;
this.loading = false; this.loading = false;
this.Items = res.data; this.Items = res.data;

View File

@@ -92,7 +92,7 @@ export default function initialize() {
//check the timezone offset is still valid, offer to change it if not //check the timezone offset is still valid, offer to change it if not
//api.get("UserOptions/" + store.state.userId).then(res => { //api.get("UserOptions/" + store.state.userId).then(res => {
api api
.get("UserOptions/bb") .get("UserOptions/" + store.state.userId)
.then(res => { .then(res => {
if (res.error) { if (res.error) {
//In a form this would trigger a bunch of validation or error display code but for here and now: //In a form this would trigger a bunch of validation or error display code but for here and now:

View File

@@ -104,7 +104,7 @@
<script> <script>
/* xeslint-disable */ /* xeslint-disable */
import api from "../api/apiutil"; import api from "../api/apiutil";
import aboutInfo from "../utils/aboutinfo"; import aboutInfo from "../api/aboutinfo";
import lt from "../api/locale"; import lt from "../api/locale";
export default { export default {
data() { data() {