chore: add eslint and fix lint errors

This commit is contained in:
2020-01-25 14:59:14 +01:00
parent e6c87e2f46
commit ef2015f012
36 changed files with 1645 additions and 917 deletions
+40 -38
View File
@@ -1,15 +1,11 @@
<template>
<v-app :key="$i18n.locale + isAuthenticated">
<themed>
<v-navigation-drawer
v-model="nav"
temporary
app
>
<v-navigation-drawer v-model="nav" temporary app>
<v-list dense>
<v-list-item>
<v-list-item-action>
<v-switch v-model="darkMode"/>
<v-switch v-model="darkMode" />
</v-list-item-action>
<v-list-item-title>{{ $t('app.darkMode') }}</v-list-item-title>
</v-list-item>
@@ -24,10 +20,10 @@
</v-list-item>
<v-list-item v-if="isAuthenticated && user">
<v-list-item-avatar>
<v-img :src="user.picture" :alt="user.name"/>
<v-img :src="user.picture" :alt="user.name" />
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-html="user.name"/>
<v-list-item-title v-html="user.name" />
</v-list-item-content>
</v-list-item>
<v-list-item link to="/">
@@ -59,23 +55,23 @@
</v-list>
</v-navigation-drawer>
<v-app-bar app scroll-off-screen>
<v-app-bar-nav-icon v-on:click="nav = !nav"/>
<v-toolbar-title v-html="title"/>
<v-spacer/>
<v-app-bar-nav-icon v-on:click="nav = !nav" />
<v-toolbar-title v-html="title" />
<v-spacer />
<v-toolbar-items>
<v-list-item v-if="isAuthenticated && user">
<v-list-item-avatar>
<v-img :src="user.picture" :alt="user.name"/>
<v-img :src="user.picture" :alt="user.name" />
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-html="user.name"/>
<v-list-item-title v-html="user.name" />
</v-list-item-content>
</v-list-item>
</v-toolbar-items>
</v-app-bar>
<v-content>
<v-container fluid v-if="!loading">
<nuxt/>
<nuxt />
</v-container>
</v-content>
</themed>
@@ -83,32 +79,32 @@
</template>
<style lang="scss">
// We need this line to import all global styling
@import "assets/scss/global.scss";
// We need this line to import all global styling
@import 'assets/scss/global.scss';
</style>
<style lang="scss" scoped>
.layout {
background-color: white;
.layout {
background-color: white;
.log-out {
cursor: pointer;
}
.log-out {
cursor: pointer;
}
}
</style>
<script>
import { useAuth } from '../plugins/auth'
import { computed, ref } from '@vue/composition-api'
import Themed from './components/themed'
import { setDarkMode } from '../utils/localStorage'
import { useRouter, useState } from '@u3u/vue-hooks'
import dayjs from 'dayjs'
import sv from 'dayjs/locale/sv'
import { setDarkMode } from '../utils/localStorage'
import Themed from './components/themed'
import useAuth from '../plugins/auth'
export default {
components: {
Themed,
Themed
},
setup(props, context) {
const { router } = useRouter()
@@ -118,16 +114,22 @@ export default {
appState && appState.targetUrl
? appState.targetUrl
: window.location.pathname
);
)
}
const { loading, isAuthenticated, user, loginWithRedirect, logout } = useAuth(onRedirectCallback)
const {
loading,
isAuthenticated,
user,
loginWithRedirect,
logout
} = useAuth(onRedirectCallback)
const doLogin = () => {
loginWithRedirect.value();
loginWithRedirect.value()
}
const doLogout = () => {
logout.value({
returnTo: window.location.origin
});
})
}
const darkMode = computed({
get: () => context.root.$vuetify.theme.dark,
@@ -138,16 +140,16 @@ export default {
})
const locale = computed({
get: () => context.root.$i18n.locale,
set: locale => {
if (locale === 'en') {
dayjs.locale(locale)
} else if (locale === 'sv') {
set: newLocale => {
if (newLocale === 'en') {
dayjs.locale(newLocale)
} else if (newLocale === 'sv') {
dayjs.locale(sv)
}
context.root.$i18n.setLocaleCookie(locale)
context.root.$vuetify.lang.current = locale
context.root.$i18n.locale = locale
context.root.$i18n.setLocaleCookie(newLocale)
context.root.$vuetify.lang.current = newLocale
context.root.$i18n.locale = newLocale
}
})
@@ -165,6 +167,6 @@ export default {
locale,
nav
}
},
};
}
}
</script>