Skip to content

Changed usage from "Storage" to "storage" to be equal with other code… #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script>
import { EventBus } from './utils/event';
import Header from './components/Header';
import Storage from './utils/storage';
import storage from './utils/storage';

export default {
name: 'App',
Expand All @@ -23,7 +23,7 @@
Header
},
mounted() {
this.darkMode = Storage.getValue('darkMode', false);
this.darkMode = storage.getValue('darkMode', false);
EventBus.$on('darkMode', (useDarkMode) => this.darkMode = useDarkMode || false);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/BottomNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

<script>
import { EventBus } from '../utils/event'
import Storage from '../utils/storage';
import storage from '../utils/storage';
export default {
data: () => ({
backgroundColor: (Storage.getValue('darkMode') ? '#212121' : 'white') + ' !important'
backgroundColor: (storage.getValue('darkMode') ? '#212121' : 'white') + ' !important'
}),
mounted() {
EventBus.$on('darkMode', (useDarkMode) => {
Expand Down
28 changes: 14 additions & 14 deletions src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@
import {
EventBus
} from '../utils/event';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
settings: [{
title: 'Credentials',
icon: 'account_circle',
elements: [{
title: `AKey: ${Storage.getValue('user', {}).akey}`,
title: `AKey: ${storage.getValue('user', {}).akey}`,
type: 'text'
}, {
title: 'Token',
value: Storage.getValue('user', {}).token,
value: storage.getValue('user', {}).token,
showPassword: false,
hint: 'It is like a password. Do not share this with people you do not trust!',
type: 'password'
Expand Down Expand Up @@ -300,12 +300,12 @@
elements: [{
title: 'Dark mode',
type: 'switch',
value: Storage.getValue('darkMode', false),
value: storage.getValue('darkMode', false),
action: 'toggleDarkMode',
hint: 'Turn off the lights'
}]
}],
token: Storage.getValue('user', {}).token,
token: storage.getValue('user', {}).token,
localSettings: {},
showSnackbar: false,
snackbarMessage: '',
Expand All @@ -325,7 +325,7 @@
this[name](params);
},
toggleDarkMode(useDarkMode) {
EventBus.$emit('darkMode', Storage.setValue('darkMode', useDarkMode || false));
EventBus.$emit('darkMode', storage.setValue('darkMode', useDarkMode || false));
},
showSaveIcon() {
EventBus.$emit('save');
Expand All @@ -345,7 +345,7 @@
});
},
logout() {
Storage.removeValue('user');
storage.removeValue('user');
this.$router.push('/login');
},
retrieveSettings() {
Expand All @@ -361,7 +361,7 @@
},
loadSettings(callback) {
const self = this;
const localSettings = Storage.getValue('settings', {});
const localSettings = storage.getValue('settings', {});

const displaySettings = (settings) => {
Object.keys(settings).forEach((key) => {
Expand All @@ -375,9 +375,9 @@

self.$root.EVNotify.getSettings((err, serverSettings) => {
if (!err && serverSettings) {
displaySettings((self.localSettings = Storage.setValue('settings', serverSettings)));
displaySettings((self.localSettings = storage.setValue('settings', serverSettings)));
} else {
displaySettings((self.localSettings = Storage.getValue('settings', {})));
displaySettings((self.localSettings = storage.getValue('settings', {})));
}
if (typeof callback === 'function') callback(err, serverSettings);
});
Expand All @@ -394,7 +394,7 @@
self.$root.EVNotify.setSettings(serverSettings, (err) => {
if (!err) {
this.localSettings = serverSettings;
Storage.setValue('settings', serverSettings);
storage.setValue('settings', serverSettings);
EventBus.$emit('unsave');
// TODO
} else {
Expand Down Expand Up @@ -440,10 +440,10 @@
self.resetTokenDialog = false;
self.showSnackbar = true;
if (!err && token) {
const user = Storage.getValue('user', {});
const user = storage.getValue('user', {});

user.token = token;
Storage.setValue('user', user);
storage.setValue('user', user);
self.snackbarType = 'success';
self.snackbarMessage = 'Token changed';
self.settings[0].elements[1].value = token;
Expand All @@ -454,7 +454,7 @@
});
},
integrateABRP() {
const user = Storage.getValue('user', {});
const user = storage.getValue('user', {});

window.open(`https://abetterrouteplanner.com/oauth/auth?client_id=8&redirect_uri=https://app.evnotify.de/integrations/abrp/auth/${user.akey}/${user.token}`, '_blank');
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
import BottomNavigation from '../components/BottomNavigation';
import Dashboard from '../components/Dashboard';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
Expand All @@ -19,7 +19,7 @@
Dashboard
},
created() {
if (!Storage.getValue('user')) return this.$router.push('/login');
if (!storage.getValue('user')) return this.$router.push('/login');
this.loggedIn = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Log.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
import BottomNavigation from '../components/BottomNavigation';
import Log from '../components/Log';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
Expand All @@ -19,7 +19,7 @@
Log
},
created() {
if (!Storage.getValue('user')) return this.$router.push('/login');
if (!storage.getValue('user')) return this.$router.push('/login');
this.loggedIn = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
import BottomNavigation from '../components/BottomNavigation';
import Logs from '../components/Logs';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
Expand All @@ -19,7 +19,7 @@
Logs
},
created() {
if (!Storage.getValue('user')) return this.$router.push('/login');
if (!storage.getValue('user')) return this.$router.push('/login');
this.loggedIn = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Robots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
import BottomNavigation from '../components/BottomNavigation';
import Robots from '../components/Robots';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
Expand All @@ -19,7 +19,7 @@
Robots
},
created() {
if (!Storage.getValue('user')) return this.$router.push('/login');
if (!storage.getValue('user')) return this.$router.push('/login');
this.loggedIn = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
import BottomNavigation from '../components/BottomNavigation';
import Settings from '../components/Settings';
import Storage from '../utils/storage';
import storage from '../utils/storage';

export default {
data: () => ({
Expand All @@ -19,7 +19,7 @@
Settings
},
created() {
if (!Storage.getValue('user')) return this.$router.push('/login');
if (!storage.getValue('user')) return this.$router.push('/login');
this.loggedIn = true;
}
}
Expand Down