diff --git a/.gitignore b/.gitignore index 8ee54e8..c93fb03 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ coverage *.sw? *.tsbuildinfo + +.env \ No newline at end of file diff --git a/src/components/Home.vue b/src/components/Home.vue index 45f67ca..88fe4a3 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -3,21 +3,88 @@ import type { Book } from "@/models/book"; import { BookService } from "@/services/book.service"; import { onMounted, ref } from "vue"; -const books = ref([]) +const API_URL = import.meta.env.VITE_MBL_API_URL +const books = ref([]); const bookService = new BookService(); onMounted(async () => { - books.value = await bookService.findBooks() + books.value = await bookService.findBooks(); }); - + diff --git a/src/models/book.ts b/src/models/book.ts index 05bf2de..a02801d 100644 --- a/src/models/book.ts +++ b/src/models/book.ts @@ -4,6 +4,7 @@ export class Book { note: number = 0 title: string = "" author: string = "" + illustration: string = "" state: 'PLAN' | 'READING' | 'COMPLETED' | 'DROPPED' = 'PLAN' added_at: Date = new Date() updated_at: Date = new Date() diff --git a/src/services/authentication.service.ts b/src/services/authentication.service.ts index 32ebf34..c53a5c1 100644 --- a/src/services/authentication.service.ts +++ b/src/services/authentication.service.ts @@ -1,11 +1,10 @@ import type { User } from "@/models/user"; import axios from "axios"; -export const MBL_API_URL = "http://localhost:8000/api/"; - export class AuthenticationService { constructor() { - axios.defaults.baseURL = `${MBL_API_URL}` + const apiURL = import.meta.env.VITE_MBL_API_URL; + axios.defaults.baseURL = `${apiURL}/api/`; } async findUsers() { diff --git a/src/services/book.service.ts b/src/services/book.service.ts index e03cb37..3486d13 100644 --- a/src/services/book.service.ts +++ b/src/services/book.service.ts @@ -1,11 +1,10 @@ import type { Book } from "@/models/book"; import axios from "axios"; -export const MBL_API_URL = "http://localhost:8000"; - export class BookService { constructor() { - axios.defaults.baseURL = `${MBL_API_URL}/api/books`; + const apiURL = import.meta.env.VITE_MBL_API_URL; + axios.defaults.baseURL = `${apiURL}/api/books`; } async findBooks() { diff --git a/src/styles.css b/src/styles.css index 5c44195..65df50b 100644 --- a/src/styles.css +++ b/src/styles.css @@ -8,6 +8,6 @@ body { color: light-dark(#121212, #efefec); - background-color: light-dark(#efedea, #121212); + background-color: light-dark(#e1e1de, #121212); min-height: 100vh; }