lesion 1 rok pred
rodič
commit
f49fdd247a

+ 7 - 5
TODO.md

@@ -4,10 +4,12 @@
 - [x] carousel in detail (o un modo per avere piu' immagini per un oggetto)
 - [x] stringo la pagina dei dettagli
 - [x] next / prev in page
-- [ ] i tag da trimmare ed eliminare se son vuoti
-- [ ] un load per next / prev
-- [ ] favicon (solo perche' senza ci mette un sacco a fare il load)
+- [x] i tag da trimmare ed eliminare se son vuoti
 - [x] form validation
-- [ ] ci vuole un modo per segnare che un oggetto e' stato preso!
-- [ ] api rate (mi sa di no perche' tutti usciremo con lo stesso ip)
+- [x] servire immagini anche x il deploy
+- [ ] un loading per next / prev
+- [ ] immagine del banner da scaricare in locale
+- [ ] favicon (solo perche' senza ci mette un sacco a fare il load)
+- [ ] ci vuole un modo per segnare che un oggetto e' stato preso? forse no se facciamo un'asta live
+- [ ] deploy
 - [ ] mail in lista

+ 2 - 2
components/carousel.vue

@@ -6,8 +6,8 @@ const { images } = defineProps(['images'])
 </script>
 <template>
   <div class='carousel max-h-100 bg-neutral'>
-    <div v-for='image in images' class='carousel-item' :key='image'>
-      <img class='carousel-center object-contain' :src="`/${image}`">
+    <div v-for='image in images' class='carousel-item w-full' :key='image'>
+      <img class='carousel-center object-contain' :src="`/api/image/${image}`">
     </div>
   </div>
 </template>

+ 1 - 1
components/cosetta.vue

@@ -8,7 +8,7 @@ const { cosetta } = defineProps({
 </script>
 <template>
   <div class="rounded overflow-hidden shadow-lg flex flex-col justify-between">
-    <img class="object-cover w-full h-48" :src="`/${cosetta.images[0]}`" alt="Mountain">
+    <img class="object-cover w-full h-48" :src="`/api/image/${cosetta.images[0]}`" alt="Mountain">
     <div class="px-6 py-4 grow">
       <nuxt-link :to="`/c/${cosetta.uuid}`">
         <h2 class="text-pink-500 card-title hover:underline uppercase mb-2 line-clamp-2" v-text='cosetta.name' />

+ 1 - 1
pages/index.vue

@@ -1,6 +1,6 @@
 <script setup>
 const page = ref(0)
-let { data, refresh } = await useFetch(() => `/api/cosette?page=${page.value}`)
+let { data, pending, refresh } = await useFetch(() => `/api/cosette?page=${page.value}`)
 
 function next() {
   page.value++

+ 1 - 1
server/services/upload-service.ts

@@ -5,7 +5,7 @@ import { v4 } from 'uuid'
 import path from 'path'
 
 export const uploadService = () => {
-  let folderPath = './public/'
+  let folderPath = './server/public/images/'
   if (!fs.existsSync(folderPath)) {
     fs.mkdirSync(folderPath, { recursive: true })
   }