feat: all Canvas endpoints implemented, just waiting for projectId to test
Some checks failed
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 42s
CI / build (push) Failing after 9s
Format / formatting (pull_request) Successful in 6s

This commit is contained in:
2025-04-29 11:24:26 +02:00
parent 351727f3d5
commit e890a03a48
4 changed files with 144 additions and 178 deletions

View File

@ -106,26 +106,6 @@ const currentDescriptions = ref<SectionCell[]>([]);
const editedDescriptions = ref<SectionCell[]>([]);
const isEditing = ref<boolean[]>([]);
function getCurrentFormattedDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0"); // +1 car janvier = 0
const day = String(now.getDate()).padStart(2, "0");
const hours = String(now.getHours()).padStart(2, "0");
const minutes = String(now.getMinutes()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}`;
}
onMounted(() => {
fetchData(
props.projectId,
props.title,
getCurrentFormattedDate(),
IS_MOCK_MODE
);
});
// Fonctions
const startEditing = (index: number) => {
isEditing.value[index] = true;
@ -169,7 +149,6 @@ const handleClick = () => {
}
};
// fetchData
const handleFetchSuccess = (sectionCells: SectionCell[]) => {
currentDescriptions.value = sectionCells;
editedDescriptions.value = sectionCells.map(
@ -186,8 +165,20 @@ const handleFetchSuccess = (sectionCells: SectionCell[]) => {
const handleFetchError = (error: unknown) => {
console.error("Erreur lors de la récupération des données :", error);
const errorCell = new SectionCell({
idSectionCell: -1,
sectionId: -1,
contentSectionCell: "Échec du chargement des données.",
modificationDate: new Date().toISOString(),
});
currentDescriptions.value = [errorCell];
editedDescriptions.value = [errorCell];
isEditing.value = [false];
};
const fetchData = async (
projectId: number,
title: number,
@ -314,6 +305,26 @@ const mockFetch = async (
setTimeout(() => resolve(result), 500);
});
};
function getCurrentFormattedDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0"); // +1 car janvier = 0
const day = String(now.getDate()).padStart(2, "0");
const hours = String(now.getHours()).padStart(2, "0");
const minutes = String(now.getMinutes()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}`;
}
onMounted(() => {
fetchData(
props.projectId,
props.title,
getCurrentFormattedDate(),
IS_MOCK_MODE
);
});
</script>
<style scoped>