unfix: pushing a version that doesn't work for review cuz i don't really get what' wrong
This commit is contained in:
parent
00a733c03b
commit
6de45801d2
@ -19,11 +19,11 @@ const router = createRouter({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// route pour les canvas (made by adnane), in fact the two vue apps are separated for now
|
// route pour les canvas (made by adnane), in fact the two vue apps are separated for now
|
||||||
{
|
/*{
|
||||||
path: '/canvas',
|
path: '/canvas',
|
||||||
name: 'canvas',
|
name: 'canvas',
|
||||||
component: () => import('../views/CanvasView.vue'),
|
component: () => import('../views/CanvasView.vue'),
|
||||||
},
|
},*/
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,13 +18,63 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Header from '../components/HeaderComponent.vue';
|
import { ref, onMounted } from "vue";
|
||||||
import Agenda from "../components/Agenda.vue"
|
import { callApi } from "@/services/api";
|
||||||
import ProjectComp from '../components/ProjectComponent.vue';
|
|
||||||
|
|
||||||
import { ref } from "vue";
|
import Header from "../components/HeaderComponent.vue";
|
||||||
|
import Agenda from "../components/Agenda.vue";
|
||||||
|
import ProjectComp from "../components/ProjectComponent.vue";
|
||||||
|
|
||||||
const projects = ref([
|
|
||||||
|
const PORT = "8081";
|
||||||
|
const URI = `http://localhost:${PORT}`;
|
||||||
|
|
||||||
|
const projects = ref<{ name: string; link: string; members: string[] }[]>([]);
|
||||||
|
|
||||||
|
const fetchProjects = () => {
|
||||||
|
callApi(
|
||||||
|
`${URI}/admin/projects`,
|
||||||
|
async (response) => {
|
||||||
|
console.log(response);
|
||||||
|
const projectList = response.data;
|
||||||
|
|
||||||
|
const projectPromises = projectList.map((project: any) => {
|
||||||
|
return new Promise(async (resolve) => {
|
||||||
|
callApi(
|
||||||
|
`${URI}/shared/projects/entrepreneurs/${project.idProject}`,
|
||||||
|
(memberResponse) => {
|
||||||
|
const members = memberResponse.data.map((m: any) => m.userName);
|
||||||
|
resolve({
|
||||||
|
name: project.projectName,
|
||||||
|
link: `/project/${project.idProject}`,
|
||||||
|
members,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// Error fetching members, still resolve with empty members
|
||||||
|
resolve({
|
||||||
|
name: project.projectName,
|
||||||
|
link: `/project/${project.idProject}`,
|
||||||
|
members: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
projects.value = await Promise.all(projectPromises);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error("Error fetching projects:", error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(fetchProjects);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*const projects = ref([
|
||||||
{
|
{
|
||||||
name: "Projet Alpha",
|
name: "Projet Alpha",
|
||||||
link: "/canvas", // to test
|
link: "/canvas", // to test
|
||||||
@ -36,7 +86,7 @@ const projects = ref([
|
|||||||
members: ["David", "Eve", "Frank"],
|
members: ["David", "Eve", "Frank"],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
*/
|
||||||
const rendezVous = ref([
|
const rendezVous = ref([
|
||||||
{ projectName: "Projet Alpha", date: "2025-03-10", lieu: "P106" },
|
{ projectName: "Projet Alpha", date: "2025-03-10", lieu: "P106" },
|
||||||
{ projectName: "Projet Beta", date: "2025-04-15", lieu: "Td10" },
|
{ projectName: "Projet Beta", date: "2025-04-15", lieu: "Td10" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user