After login go back to original page.
This commit is contained in:
parent
2ba961ce2a
commit
07f50afa32
4 changed files with 38 additions and 27 deletions
|
|
@ -5,7 +5,7 @@
|
|||
<nav>
|
||||
<RouterLink
|
||||
class="nav-item"
|
||||
to="/profile">
|
||||
to="/">
|
||||
<i class="pi pi-home nav-icon" />
|
||||
<span>Home</span>
|
||||
</RouterLink>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const localActions = [{
|
|||
command: () => { router.push('/88ae126f-b19a-4287-abe0-a8f5ac763cb7'); },
|
||||
icon: 'pi pi-tag',
|
||||
label: 'Claim 88ae',
|
||||
needsAuth: true,
|
||||
needsAuth: false,
|
||||
}, {
|
||||
icon: 'pi pi-question',
|
||||
label: 'About',
|
||||
|
|
@ -50,19 +50,28 @@ const items = ref(allActions);
|
|||
<template>
|
||||
<header class="flex justify-between items-center px-4">
|
||||
<div class="flex">
|
||||
<svg class="Icon" style="height: 32px; width: 32px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<g class="" style="" transform="translate(0,0)">
|
||||
<path d="M329.8 235.69l62.83-82.71 42.86 32.56-62.83 82.75zm-12.86-9.53l66.81-88-45-34.15-66.81 88zm-27.48-97.78l-19.3 39.57 57-75-42.51-32.3-36.24 47.71zm-20.74-73.24l-46.64-35.43-42 55.31 53.67 26.17zm107 235.52l-139-102.71-9.92.91 4.56 2 62.16 138.43-16.52 2.25-57.68-128.5-40-17.7-4-30.84 39.41 19.42 36.36-3.33 17-34.83-110.9-54.09-80.68 112.51L177.6 346.67l-22.7 145.62H341V372.62l35.29-48.93L387 275.77z" fill="#000" fill-opacity="1">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
<RouterLink to="/">
|
||||
<svg
|
||||
class="Icon"
|
||||
style="height: 32px; width: 32px;"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g class="" style="" transform="translate(0,0)">
|
||||
<path
|
||||
d="M329.8 235.69l62.83-82.71 42.86 32.56-62.83 82.75zm-12.86-9.53l66.81-88-45-34.15-66.81 88zm-27.48-97.78l-19.3 39.57 57-75-42.51-32.3-36.24 47.71zm-20.74-73.24l-46.64-35.43-42 55.31 53.67 26.17zm107 235.52l-139-102.71-9.92.91 4.56 2 62.16 138.43-16.52 2.25-57.68-128.5-40-17.7-4-30.84 39.41 19.42 36.36-3.33 17-34.83-110.9-54.09-80.68 112.51L177.6 346.67l-22.7 145.62H341V372.62l35.29-48.93L387 275.77z"
|
||||
fill="#000"
|
||||
fill-opacity="1">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</RouterLink>
|
||||
<span class="title">{{ page_title }}</span>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<Button
|
||||
as="router-link"
|
||||
to="/login"
|
||||
v-if="userStore.isAnonymous">
|
||||
as="router-link"
|
||||
:to="{name: 'login', query: {next: route.fullPath }}"
|
||||
v-if="userStore.isAnonymous">
|
||||
<i class="pi pi-sign-in" />
|
||||
<span>Login</span>
|
||||
</Button>
|
||||
|
|
@ -70,9 +79,16 @@ const items = ref(allActions);
|
|||
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true">
|
||||
<template #start>
|
||||
<span class="inline-flex items-center gap-1 px-2 py-2">
|
||||
<svg class="Icon" style="height: 32px; width: 32px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<svg
|
||||
class="Icon"
|
||||
style="height: 32px; width: 32px;"
|
||||
viewBox="0 0 512 512"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g class="" style="" transform="translate(0,0)">
|
||||
<path d="M329.8 235.69l62.83-82.71 42.86 32.56-62.83 82.75zm-12.86-9.53l66.81-88-45-34.15-66.81 88zm-27.48-97.78l-19.3 39.57 57-75-42.51-32.3-36.24 47.71zm-20.74-73.24l-46.64-35.43-42 55.31 53.67 26.17zm107 235.52l-139-102.71-9.92.91 4.56 2 62.16 138.43-16.52 2.25-57.68-128.5-40-17.7-4-30.84 39.41 19.42 36.36-3.33 17-34.83-110.9-54.09-80.68 112.51L177.6 346.67l-22.7 145.62H341V372.62l35.29-48.93L387 275.77z" fill="#000" fill-opacity="1">
|
||||
<path
|
||||
d="M329.8 235.69l62.83-82.71 42.86 32.56-62.83 82.75zm-12.86-9.53l66.81-88-45-34.15-66.81 88zm-27.48-97.78l-19.3 39.57 57-75-42.51-32.3-36.24 47.71zm-20.74-73.24l-46.64-35.43-42 55.31 53.67 26.17zm107 235.52l-139-102.71-9.92.91 4.56 2 62.16 138.43-16.52 2.25-57.68-128.5-40-17.7-4-30.84 39.41 19.42 36.36-3.33 17-34.83-110.9-54.09-80.68 112.51L177.6 346.67l-22.7 145.62H341V372.62l35.29-48.93L387 275.77z"
|
||||
fill="#000"
|
||||
fill-opacity="1">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -9,21 +9,13 @@ import StickerView from '../views/StickerView.vue'
|
|||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
component: HomeView,
|
||||
meta: {
|
||||
title: 'Home',
|
||||
},
|
||||
name: 'home',
|
||||
path: '/',
|
||||
},
|
||||
{
|
||||
component: ProfileView,
|
||||
meta: {
|
||||
title: 'Profile',
|
||||
title: '',
|
||||
},
|
||||
name: 'profile',
|
||||
path: '/profile',
|
||||
path: '/',
|
||||
},
|
||||
{
|
||||
component: AboutView,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import Button from 'primevue/button';
|
||||
import { Form } from '@primevue/forms';
|
||||
|
|
@ -14,13 +14,16 @@ const userStore = useUserStore();
|
|||
const username = ref();
|
||||
const password = ref();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const next = route.query.next;
|
||||
|
||||
|
||||
function handleLogin({ valid }) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
userStore.login(username.value, username.value).then((data) => {
|
||||
// TODO: Go back to original page.
|
||||
router.push('/');
|
||||
router.push(next);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue