This commit is contained in:
17
ayanova/src/api/getAPIItem.js
Normal file
17
ayanova/src/api/getAPIItem.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/* xeslint-disable */
|
||||
import apiUtil from "./apiutil";
|
||||
export default {
|
||||
get(route) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
fetch(apiUtil.APIUrl(route), apiUtil.fetchGetOptions())
|
||||
.then(apiUtil.status)
|
||||
.then(apiUtil.json)
|
||||
.then(response => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch(function(error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,8 @@
|
||||
/* xeslint-disable */
|
||||
/* eslint-disable */
|
||||
import store from "../store";
|
||||
import roles from "./roles";
|
||||
import lt from "../api/locale";
|
||||
import api from "../api/getAPIItem";
|
||||
|
||||
function addNavItem(title, icon, route) {
|
||||
store.commit("addNavItem", {
|
||||
@@ -16,6 +17,29 @@ function addNavItem(title, icon, route) {
|
||||
// on change of authentication status
|
||||
export default function initialize() {
|
||||
if (store.state.authenticated) {
|
||||
//Fetch the users options for local caching
|
||||
|
||||
//check the timezone offset is still valid, offer to change it if not
|
||||
|
||||
api.get("UserOptions/" + store.state.userId).then(res => {
|
||||
//debugger;
|
||||
var localOffset = new Date().getTimezoneOffset();
|
||||
if (localOffset != 0) {
|
||||
localOffset = (localOffset / 60) * -1; //time is in minutes and reversed from what we want or expect
|
||||
}
|
||||
|
||||
if (res.data.timeZoneOffset != localOffset) {
|
||||
//todo: timezone doesn't match, offer to fix it
|
||||
alert(
|
||||
"Time zone offset for this account is set to " +
|
||||
res.data.timeZoneOffset +
|
||||
" which doesn't match the local timezone offset of " +
|
||||
localOffset +
|
||||
"."
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//fetch the required localized text keys into the cache
|
||||
lt.fetch([
|
||||
"Home",
|
||||
|
||||
Reference in New Issue
Block a user