Access route to single book form
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { RouterLink } from 'vue-router'
|
import { useRouter, RouterLink } from 'vue-router'
|
||||||
import NavBarSearch from './NavBarSearch.vue'
|
import NavBarSearch from './NavBarSearch.vue'
|
||||||
import { useAuthStore } from './auth.store.js'
|
import { useAuthStore } from './auth.store.js'
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
|
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
id: Number,
|
||||||
title: String,
|
title: String,
|
||||||
author: String,
|
author: String,
|
||||||
imagePath: String,
|
imagePath: String,
|
||||||
@@ -8,13 +10,17 @@
|
|||||||
read: Boolean
|
read: Boolean
|
||||||
});
|
});
|
||||||
const imagePathOrDefault = (props.imagePath == "" || typeof props.imagePath === 'undefined') ? "defaultbook.png" : props.imagePath;
|
const imagePathOrDefault = (props.imagePath == "" || typeof props.imagePath === 'undefined') ? "defaultbook.png" : props.imagePath;
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
function openBook() {
|
||||||
|
router.push(`/book/${props.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="box container has-background-dark">
|
<div class="box container has-background-dark" >
|
||||||
<div class="media">
|
<div class="media" @click="openBook">
|
||||||
<div class="media-left">
|
<div class="media-left">
|
||||||
<figure class="image mb-3">
|
<figure class="image mb-3">
|
||||||
<img v-bind:src="imagePathOrDefault" v-bind:alt="title">
|
<img v-bind:src="imagePathOrDefault" v-bind:alt="title">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
id: Number,
|
||||||
title: String,
|
title: String,
|
||||||
author: String,
|
author: String,
|
||||||
id: Number,
|
id: Number,
|
||||||
@@ -23,6 +24,10 @@ async function onUserBookRead() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openBook() {
|
||||||
|
router.push(`/book/${props.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -30,7 +35,7 @@ async function onUserBookRead() {
|
|||||||
<p>{{error}}</p>
|
<p>{{error}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="columns no-padding box container has-background-dark">
|
<div class="columns no-padding box container has-background-dark">
|
||||||
<div class="media column no-margin">
|
<div class="media column no-margin" @click="openBook">
|
||||||
<div class="media-left">
|
<div class="media-left">
|
||||||
<figure class="image mb-3">
|
<figure class="image mb-3">
|
||||||
<img v-bind:src="imagePathOrDefault" v-bind:alt="title">
|
<img v-bind:src="imagePathOrDefault" v-bind:alt="title">
|
||||||
|
|||||||
Reference in New Issue
Block a user