fix + feat: api test + error fix
This commit is contained in:
parent
9f3754776f
commit
d75d45e204
@ -3,6 +3,8 @@
|
||||
{ "id": 1, "name": "Alice", "email": "alice@example.com" },
|
||||
{ "id": 2, "name": "Bob", "email": "bob@example.com" },
|
||||
{ "id": 3, "name": "Charlie", "email": "charlie@example.com" }
|
||||
],
|
||||
"data": [
|
||||
{ "data": "this is a fake data to test api" }
|
||||
]
|
||||
}
|
||||
|
2
front/MyINPulse-front/fake_data/open.sh
Executable file
2
front/MyINPulse-front/fake_data/open.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/bash
|
||||
json-server --watch db.json --port 5000
|
@ -10,7 +10,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -22,11 +23,21 @@
|
||||
const expanded = ref(false);
|
||||
const currentDescription = ref(props.description);
|
||||
|
||||
const toggleExpand = () => {
|
||||
currentDescription.value = expanded.value
|
||||
? "3 problèmes essentiels à résoudre pour le client"
|
||||
: "FAKE DATA";
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const response = await axios.get("http://localhost:5000/data"); // to edit later!
|
||||
currentDescription.value = response.data.map(e => e.data);
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de la récupération des données :", error);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleExpand = async () => {
|
||||
if (!expanded.value) {
|
||||
await fetchData();
|
||||
} else {
|
||||
currentDescription.value = "3 problèmes essentiels à résoudre pour le client";
|
||||
}
|
||||
expanded.value = !expanded.value;
|
||||
};
|
||||
|
||||
@ -39,6 +50,7 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
@import "@/components/canvas/style-project.css";
|
||||
|
||||
@ -82,6 +94,4 @@
|
||||
justify-content: center;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -17,39 +17,35 @@
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isDropdownOpen: false,
|
||||
entrepreneurEmails: [],
|
||||
const isDropdownOpen = ref(false);
|
||||
const entrepreneurEmails = ref([]);
|
||||
|
||||
const toggleDropdown = () => {
|
||||
isDropdownOpen.value = !isDropdownOpen.value;
|
||||
console.log("Dropdown toggled:", isDropdownOpen.value); // for debug purposes
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
toggleDropdown() {
|
||||
this.isDropdownOpen = !this.isDropdownOpen;
|
||||
console.log("Dropdown toggled:", this.isDropdownOpen); //for debug purposes
|
||||
},
|
||||
async fetchEntrepreneurs() {
|
||||
|
||||
const fetchEntrepreneurs = async () => {
|
||||
try {
|
||||
const response = await axios.get("http://localhost:5000/entrepreneurs");
|
||||
this.entrepreneurEmails = response.data.map(e => e.email);
|
||||
entrepreneurEmails.value = response.data.map(e => e.email);
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de la récupération des entrepreneurs:", error);
|
||||
}
|
||||
},
|
||||
contactAll() {
|
||||
alert("Contacter tous les entrepreneurs : " + this.entrepreneurEmails.join(", "));
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchEntrepreneurs();
|
||||
},
|
||||
};
|
||||
|
||||
const contactAll = () => {
|
||||
alert("Contacter tous les entrepreneurs : " + entrepreneurEmails.value.join(", "));
|
||||
};
|
||||
|
||||
onMounted(fetchEntrepreneurs);
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
|
||||
header {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 39 KiB |
@ -1,10 +1,3 @@
|
||||
<script setup lang="ts">
|
||||
import Header from '../components/Header.vue';
|
||||
import Agenda from "../components/Agenda.vue"
|
||||
import ProjectComp from '../components/Project-comp.vue';
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<Header />
|
||||
<error-wrapper></error-wrapper>
|
||||
@ -25,6 +18,9 @@ import ProjectComp from '../components/Project-comp.vue';
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Header from '../components/Header.vue';
|
||||
import Agenda from "../components/Agenda.vue"
|
||||
import ProjectComp from '../components/Project-comp.vue';
|
||||
|
||||
import { ref } from "vue";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user