|
|
@@ -10,12 +10,12 @@ const endDateInput = document.getElementById('endDate');
|
|
|
const placeInput = document.getElementById('place');
|
|
|
|
|
|
|
|
|
-window.onload = async function() {
|
|
|
+window.addEventListener("load", async function() {
|
|
|
document.getElementById("appointment-btn").addEventListener('click', async () => {
|
|
|
await createAppointment();
|
|
|
})
|
|
|
-
|
|
|
-}
|
|
|
+ console.log(titleInput.value);
|
|
|
+});
|
|
|
|
|
|
async function fetchWithToken(url, options) {
|
|
|
const authToken = localStorage.getItem('token');
|
|
|
@@ -56,8 +56,11 @@ async function createAppointment() {
|
|
|
appointmentSuccessParagraph.innerText = "";
|
|
|
appointmentErrorParagraph.innerText = js["message"];
|
|
|
} else {
|
|
|
+ const path = `/html/schedule.html?appointment=${js["id"]}`;
|
|
|
appointmentErrorParagraph.innerText = "";
|
|
|
- appointmentSuccessParagraph.innerText = "Appointment created successfully.";
|
|
|
+ appointmentSuccessParagraph.innerText = "Appointment created successfully. The share link " +
|
|
|
+ "was copied to your clipboard";
|
|
|
+ await navigator.clipboard.writeText(`${window.location.origin}${path}`);
|
|
|
}
|
|
|
}
|
|
|
|