mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-23 02:59:17 +01:00
-Min refactor
-Fix unauth access -not tested -Fix initial them setting
This commit is contained in:
parent
a3bef880a0
commit
68d3b0fcc3
@ -15,12 +15,13 @@ export default (props, { $f7, $, $update, $onMounted }) => {
|
|||||||
|
|
||||||
let theme = themes.getters.Name.value;
|
let theme = themes.getters.Name.value;
|
||||||
|
|
||||||
$onMounted(() => {
|
$onMounted(async () => {
|
||||||
localForage.getItem('theme').then( (value) => {
|
const items = await localForage.length();
|
||||||
theme = value;
|
if (items > 0){
|
||||||
if (value != 'theme-dark'){ $("#app").removeClass("theme-dark"); }
|
theme = await localForage.getItem('theme');
|
||||||
|
if (theme != 'theme-dark'){ $("#app").removeClass("theme-dark"); }
|
||||||
themes.dispatch('changeTheme', theme);
|
themes.dispatch('changeTheme', theme);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return $render;
|
return $render;
|
||||||
|
@ -19,6 +19,9 @@ import http from './api/config.js';
|
|||||||
// Import main app component
|
// Import main app component
|
||||||
import App from '../app.f7.html';
|
import App from '../app.f7.html';
|
||||||
|
|
||||||
|
// Import user store
|
||||||
|
import user from './stores/user.js';
|
||||||
|
|
||||||
var device = getDevice();
|
var device = getDevice();
|
||||||
var app = new Framework7({
|
var app = new Framework7({
|
||||||
name: 'Comida Cab', // App name
|
name: 'Comida Cab', // App name
|
||||||
@ -69,7 +72,7 @@ var app = new Framework7({
|
|||||||
http.interceptors.response.use(undefined, function (err) {
|
http.interceptors.response.use(undefined, function (err) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (err.status === 401 && err.config && !err.config.__isRetryRequest) {
|
if (err.status === 401 && err.config && !err.config.__isRetryRequest) {
|
||||||
//user.dispatch('logout'); //To fix
|
user.dispatch('logOut').then( () => { } ); //Untested
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
@ -32,8 +32,8 @@ const user = createStore({
|
|||||||
logOut({ state, dispatch }){
|
logOut({ state, dispatch }){
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
dispatch('logout');
|
dispatch('logout');
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token');
|
||||||
http.defaults.headers.common['Authorization'];
|
delete http.defaults.headers.common['Authorization'];
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user