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>
|
<nav>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
class="nav-item"
|
class="nav-item"
|
||||||
to="/profile">
|
to="/">
|
||||||
<i class="pi pi-home nav-icon" />
|
<i class="pi pi-home nav-icon" />
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ const localActions = [{
|
||||||
command: () => { router.push('/88ae126f-b19a-4287-abe0-a8f5ac763cb7'); },
|
command: () => { router.push('/88ae126f-b19a-4287-abe0-a8f5ac763cb7'); },
|
||||||
icon: 'pi pi-tag',
|
icon: 'pi pi-tag',
|
||||||
label: 'Claim 88ae',
|
label: 'Claim 88ae',
|
||||||
needsAuth: true,
|
needsAuth: false,
|
||||||
}, {
|
}, {
|
||||||
icon: 'pi pi-question',
|
icon: 'pi pi-question',
|
||||||
label: 'About',
|
label: 'About',
|
||||||
|
|
@ -50,19 +50,28 @@ const items = ref(allActions);
|
||||||
<template>
|
<template>
|
||||||
<header class="flex justify-between items-center px-4">
|
<header class="flex justify-between items-center px-4">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<svg class="Icon" style="height: 32px; width: 32px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
<RouterLink to="/">
|
||||||
<g class="" style="" transform="translate(0,0)">
|
<svg
|
||||||
<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">
|
class="Icon"
|
||||||
</path>
|
style="height: 32px; width: 32px;"
|
||||||
</g>
|
viewBox="0 0 512 512"
|
||||||
</svg>
|
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>
|
<span class="title">{{ page_title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
as="router-link"
|
as="router-link"
|
||||||
to="/login"
|
:to="{name: 'login', query: {next: route.fullPath }}"
|
||||||
v-if="userStore.isAnonymous">
|
v-if="userStore.isAnonymous">
|
||||||
<i class="pi pi-sign-in" />
|
<i class="pi pi-sign-in" />
|
||||||
<span>Login</span>
|
<span>Login</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -70,9 +79,16 @@ const items = ref(allActions);
|
||||||
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true">
|
<Menu ref="menu" id="overlay_menu" :model="items" :popup="true">
|
||||||
<template #start>
|
<template #start>
|
||||||
<span class="inline-flex items-center gap-1 px-2 py-2">
|
<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)">
|
<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>
|
</path>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
|
@ -9,21 +9,13 @@ import StickerView from '../views/StickerView.vue'
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
|
||||||
component: HomeView,
|
|
||||||
meta: {
|
|
||||||
title: 'Home',
|
|
||||||
},
|
|
||||||
name: 'home',
|
|
||||||
path: '/',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
component: ProfileView,
|
component: ProfileView,
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Profile',
|
title: '',
|
||||||
},
|
},
|
||||||
name: 'profile',
|
name: 'profile',
|
||||||
path: '/profile',
|
path: '/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: AboutView,
|
component: AboutView,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import Button from 'primevue/button';
|
import Button from 'primevue/button';
|
||||||
import { Form } from '@primevue/forms';
|
import { Form } from '@primevue/forms';
|
||||||
|
|
@ -14,13 +14,16 @@ const userStore = useUserStore();
|
||||||
const username = ref();
|
const username = ref();
|
||||||
const password = ref();
|
const password = ref();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const next = route.query.next;
|
||||||
|
|
||||||
|
|
||||||
function handleLogin({ valid }) {
|
function handleLogin({ valid }) {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userStore.login(username.value, username.value).then((data) => {
|
userStore.login(username.value, username.value).then((data) => {
|
||||||
// TODO: Go back to original page.
|
router.push(next);
|
||||||
router.push('/');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue