diff --git a/src/components/Authenticate.vue b/src/components/Authenticate.vue
index 317af9f..81efd82 100644
--- a/src/components/Authenticate.vue
+++ b/src/components/Authenticate.vue
@@ -1,6 +1,7 @@
-
-
+
+
+ {{ book.title }}
+
+
-
+
diff --git a/src/const.ts b/src/const.ts
new file mode 100644
index 0000000..be6231c
--- /dev/null
+++ b/src/const.ts
@@ -0,0 +1,4 @@
+export const PLAN_TO_READ = 'PLAN'
+export const READING = 'READING'
+export const COMPLETED = 'COMPLETED'
+export const DROPPED = 'DROPPED'
\ No newline at end of file
diff --git a/src/models/book.ts b/src/models/book.ts
index f64b998..05bf2de 100644
--- a/src/models/book.ts
+++ b/src/models/book.ts
@@ -1,9 +1,10 @@
+
export class Book {
id: number = 0
note: number = 0
title: string = ""
author: string = ""
- state: string = "PLAN"
+ state: 'PLAN' | 'READING' | 'COMPLETED' | 'DROPPED' = 'PLAN'
added_at: Date = new Date()
updated_at: Date = new Date()
}
\ No newline at end of file
diff --git a/src/routes.ts b/src/routes.ts
index ef20f52..7c1632e 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -4,13 +4,12 @@ import Home from './components/Home.vue'
const routes = [
{
- path: '/home',
+ path: '/',
component: Home,
name: "Home",
- meta: { requiresAuth: true }
},
{
- path: '/',
+ path: '/authenticate',
component: Authenticate,
name: "Authenticate",
meta: { guestOnly: true }
@@ -25,10 +24,6 @@ export const router = createRouter({
router.beforeEach((to, from) => {
const authenticated = sessionStorage.getItem('access');
- if (to.meta.requiresAuth && !authenticated) {
- return { name: 'Authenticate' };
- }
-
if (to.meta.guestOnly && authenticated) {
return { name: 'Home' };
}
diff --git a/src/services/book.service.ts b/src/services/book.service.ts
new file mode 100644
index 0000000..e03cb37
--- /dev/null
+++ b/src/services/book.service.ts
@@ -0,0 +1,21 @@
+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`;
+ }
+
+ async findBooks() {
+ return await axios
+ .get("")
+ .then((res) => {
+ return res.data as Book[];
+ })
+ .catch((error) => {
+ throw error;
+ });
+ }
+}