Skip to content
Snippets Groups Projects
Commit 57aa8dbd authored by Bastien's avatar Bastien
Browse files

affichage films vus sur page d'mon compte

parent 1685d4e9
No related branches found
No related tags found
No related merge requests found
<script setup>
import Header from '@/components/Header.vue'
import FilmRow from '@/components/FilmRow.vue'
import { ref, onMounted } from 'vue';
......@@ -7,6 +8,7 @@ let username = ref('');
let firstname = ref('');
let lastname = ref('');
let birthdate = ref('');
let mesFilmsVus = ref([])
function getUserInfo() {
const req = fetch('http://localhost:3000/user', { credentials: 'include' }).then(response => {
......@@ -28,6 +30,27 @@ function getUserInfo() {
}
async function fetchSeenMovies() {
try {
const response = await fetch('http://localhost:3000/user/seenMovies', { credentials: 'include' });
if (response.ok) {
const data = await response.json();
if (data) {
console.log(data);
mesFilmsVus.value = data;
}
} else {
const errorData = await response.json();
console.error('Error:', response.status, errorData);
}
} catch (error) {
console.error('Error during API call:', error);
}
}
onMounted(() => {
getUserInfo();
});
......@@ -48,9 +71,8 @@ onMounted(() => {
<button>Changer de nom d'utilisateur</button>
<button>Changer de mot de passe</button>
</div>
<h1>Films préférés :</h1>
<h1>Films préférés :</h1>
<FilmRow :films="mesFilmsVus"></FilmRow>
</template>
<style scoped>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment