chore: migrate to composition API and auth0-spa

This commit is contained in:
2020-01-21 15:51:51 +01:00
parent 565a3aa66e
commit e6c87e2f46
44 changed files with 2489 additions and 1585 deletions
-48
View File
@@ -1,48 +0,0 @@
<template>
<div>
<app-loader v-if="!authFailed" overlay>
<h2>Authenticating...</h2>
</app-loader>
<app-message v-if="authFailed" :description="err.errorDescription" message="Failed to authenticate.">
<template slot="extras">
<Button type="primary" @click="triggerLogin">Log in</Button>
</template>
</app-message>
</div>
</template>
<script>
import auth from "~/utils/auth";
export default {
data() {
return {
authFailed: false,
err: {}
};
},
mounted() {
auth
.handleAuthentication()
.then(this.authorized)
.catch(this.unauthorized);
},
methods: {
authorized({ returnUrl }) {
this.$router.replace(returnUrl);
},
unauthorized(err) {
this.authFailed = true;
this.err = err;
},
triggerLogin() {
const errorState =
this.err && this.err.state ? JSON.parse(this.err.state) : null;
const returnUrl =
errorState && errorState.returnUrl ? errorState.returnUrl : "/";
auth.triggerLogin({ returnUrl });
}
}
};
</script>
+3 -1
View File
@@ -4,14 +4,16 @@
<script>
import Filters from "~/components/pages/filters";
import { useTranslation } from '../plugins/i18n'
export default {
components: {
Filters
},
head() {
const { t } = useTranslation()
return {
title: "Dancefinder - Filter"
title: t('filters.title')
};
}
};
+3 -1
View File
@@ -4,14 +4,16 @@
<script>
import Events from "~/components/pages/events";
import { useTranslation } from '../plugins/i18n'
export default {
components: {
Events
},
head() {
const { t } = useTranslation()
return {
title: "Dancefinder - Evenemang"
title: t('events.title')
};
}
};
-17
View File
@@ -1,17 +0,0 @@
<template>
<app-message message="You are logged out.">
<h1 slot="icon">🎉</h1>
</app-message>
</template>
<script>
import auth from "~/utils/auth";
export default {
layout: "default",
mounted() {
auth.logout();
this.$router.replace('/')
}
};
</script>
+3 -1
View File
@@ -4,14 +4,16 @@
<script>
import Origins from "~/components/pages/origins";
import { useTranslation } from '../plugins/i18n'
export default {
components: {
Origins
},
head() {
const { t } = useTranslation()
return {
title: "Dancefinder - Startpunkter"
title: t('origins.title')
};
}
};