funkwhale/front/src/views/auth/Login.vue

48 wiersze
1.1 KiB
Vue
Czysty Zwykły widok Historia

2022-04-18 16:17:51 +00:00
<script setup lang="ts">
2022-07-20 22:44:19 +00:00
import type { RouteLocationRaw } from 'vue-router'
2022-04-18 16:17:51 +00:00
import LoginForm from '~/components/auth/LoginForm.vue'
import { useRouter } from 'vue-router'
import { computed } from 'vue'
import { useGettext } from 'vue3-gettext'
import { useStore } from '~/store'
2022-04-18 16:17:51 +00:00
2022-05-01 15:21:33 +00:00
interface Props {
2022-07-20 22:44:19 +00:00
next?: RouteLocationRaw
2022-05-01 15:21:33 +00:00
}
const props = withDefaults(defineProps<Props>(), {
next: '/library'
})
2022-04-18 16:17:51 +00:00
const { $pgettext } = useGettext()
const labels = computed(() => ({
title: $pgettext('Head/Login/Title', 'Log In')
}))
const store = useStore()
if (store.state.auth.authenticated) {
const router = useRouter()
const resolved = router.resolve(props.next)
router.push(resolved.name === '404' ? '/library' : props.next)
}
</script>
2019-09-23 09:14:54 +00:00
<template>
2021-12-06 10:35:20 +00:00
<main
v-title="labels.title"
class="main pusher"
>
2019-09-23 09:14:54 +00:00
<section class="ui vertical stripe segment">
<div class="ui small text container">
2021-12-06 10:35:20 +00:00
<h2>
<translate translate-context="Content/Login/Title/Verb">
Log in to your Funkwhale account
</translate>
</h2>
<login-form :next="next" />
2019-09-23 09:14:54 +00:00
</div>
</section>
</main>
</template>