fix: still having 403 bit fixed some bugs
This commit is contained in:
@ -40,6 +40,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Project from "@/ApiClasses/Project";
|
||||
import { requestProjectCreation } from "@/services/Apis/Entrepreneurs.ts";
|
||||
|
||||
const choix = ref<string | null>(null);
|
||||
const nomProjet = ref("");
|
||||
@ -53,8 +55,36 @@ const validerCreation = () => {
|
||||
alert("Veuillez entrer un nom de projet.");
|
||||
return;
|
||||
}
|
||||
alert(`Projet "${nomProjet.value}" créé avec succès !`);
|
||||
|
||||
// Obtenir la date actuelle au format YYYY-MM-DD
|
||||
const today = new Date();
|
||||
const yyyy = today.getFullYear();
|
||||
const mm = String(today.getMonth() + 1).padStart(2, "0");
|
||||
const dd = String(today.getDate()).padStart(2, "0");
|
||||
const formattedDate = `${yyyy}-${mm}-${dd}`;
|
||||
|
||||
// Créer une instance de Project
|
||||
const nouveauProjet = new Project({
|
||||
projectName: nomProjet.value.trim(),
|
||||
creationDate: formattedDate,
|
||||
status: "PENDING",
|
||||
});
|
||||
|
||||
// Appeler l’API
|
||||
requestProjectCreation(
|
||||
nouveauProjet,
|
||||
(response) => {
|
||||
console.log("Projet créé :", response.data);
|
||||
alert(`Projet "${nomProjet.value}" créé avec succès !`);
|
||||
},
|
||||
(error) => {
|
||||
console.error("Erreur lors de la création du projet :", error);
|
||||
alert("Une erreur est survenue lors de la création du projet.");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Reference in New Issue
Block a user