1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="UTF-8">
|
---|
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
6 | <title>Flight Reviews</title>
|
---|
7 | <link rel="stylesheet" href="/css/main.css">
|
---|
8 | <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
|
---|
9 | </head>
|
---|
10 | <body>
|
---|
11 |
|
---|
12 | <div id="app" class="review-page">
|
---|
13 | <header class="app-header">
|
---|
14 | <button class="logout-btn" @click="logout">Log Out</button>
|
---|
15 | </header>
|
---|
16 |
|
---|
17 | <div class="main-content">
|
---|
18 | <div class="review-container">
|
---|
19 | <h1>Flight Reviews</h1>
|
---|
20 |
|
---|
21 | <div class="review-list">
|
---|
22 | <div v-for="review in reviews" :key="review.id" class="review-item">
|
---|
23 | <h3>{{ review.subject }}</h3>
|
---|
24 | <p>{{ review.description }}</p>
|
---|
25 | <span>{{ review.date }}</span>
|
---|
26 | </div>
|
---|
27 | </div>
|
---|
28 | </div>
|
---|
29 | </div>
|
---|
30 | </div>
|
---|
31 |
|
---|
32 | <script>
|
---|
33 | new Vue({
|
---|
34 | el: '#app',
|
---|
35 | data: {
|
---|
36 | reviews: [
|
---|
37 | {
|
---|
38 | id: 1,
|
---|
39 | subject: 'Great experience!',
|
---|
40 | description: 'The flight was amazing, the service was excellent, and the views were breathtaking.',
|
---|
41 | date: '2025-02-01',
|
---|
42 | },
|
---|
43 | {
|
---|
44 | id: 2,
|
---|
45 | subject: 'Good but delayed',
|
---|
46 | description: 'The flight was comfortable, but it was delayed by two hours, which caused some inconvenience.',
|
---|
47 | date: '2025-02-02',
|
---|
48 | },
|
---|
49 | {
|
---|
50 | id: 3,
|
---|
51 | subject: 'Okay, but not perfect',
|
---|
52 | description: 'Everything was fine, but the food options could have been better.',
|
---|
53 | date: '2025-02-03',
|
---|
54 | },
|
---|
55 | ]
|
---|
56 | },
|
---|
57 | methods: {
|
---|
58 | logout() {
|
---|
59 | window.location.href = '/';
|
---|
60 | }
|
---|
61 | },
|
---|
62 | mounted() {
|
---|
63 | axios.get('api/reviews')
|
---|
64 | .then(response => {
|
---|
65 | this.review = response.data;
|
---|
66 | })
|
---|
67 | .catch(error => {
|
---|
68 | console.error("Error fetching reviews", error);
|
---|
69 | });
|
---|
70 | }
|
---|
71 | });
|
---|
72 | </script>
|
---|
73 |
|
---|
74 | </body>
|
---|
75 | </html>
|
---|