Skip to content

Commit

Permalink
frontend clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
rkshaon committed Sep 11, 2024
1 parent 31b033c commit b338559
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VUE_APP_BACKEND_URL=https://api.production-url.com # Your production backend URL
VUE_APP_BACKEND_URL=https://api.production-url.com
3 changes: 0 additions & 3 deletions frontend/src/components/BookCardComponent.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<template>
<div class="bg-white shadow-lg rounded-lg overflow-hidden">
<!-- <img :src="book.cover_image" alt="Book Cover" class="w-full h-48 object-cover"> -->
<img :src="getCoverImageUrl(book.cover_image)" alt="Book Cover" class="w-full h-48 object-cover">
<div class="p-4">
<h3 class="text-lg font-bold text-gray-800">{{ book.title }}</h3>
<!-- <p class="text-gray-600">{{ book.authors.join(', ') }}</p> -->
<p class="text-gray-600">{{ book.authors.map(author => author.full_name).join(', ') }}</p>
</div>
</div>
Expand All @@ -21,7 +19,6 @@ export default {
},
methods: {
getCoverImageUrl (coverImage) {
// const baseURL = 'http://localhost:8001/'
const API_BASE_URL = process.env.VUE_APP_BACKEND_URL
return coverImage ? `${API_BASE_URL}${coverImage}` : 'https://fastly.picsum.photos/id/1/200/300.jpg?hmac=jH5bDkLr6Tgy3oAg5khKCHeunZMHq0ehBZr6vGifPLY' // Fallback to default image if cover_image is null
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/services/v1/bookAPIService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import axios from 'axios'

const API_BASE_URL = process.env.VUE_APP_BACKEND_URL

console.log('url', API_BASE_URL)

export default {
async fetchV1Books(url) {
const finalUrl = url || `${API_BASE_URL}/book/v1/?page_size=8`;
Expand Down

0 comments on commit b338559

Please sign in to comment.