datum hinzu fügen
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
use gloo::net::http::{Method, Request};
|
||||
use gloo::net::http::Request;
|
||||
use terminwahl_typen::{Nutzer, PlannedAppointment, RequestState};
|
||||
|
||||
use crate::Msg;
|
||||
|
||||
pub async fn fetch_teachers() -> Result<Msg, Msg> {
|
||||
// Send the request to the specified URL.
|
||||
let response = Request::new("/get/teachers").send().await;
|
||||
let response = Request::get("/get/teachers/1").send().await;
|
||||
// Return the ZuordnungMessage with the given network object and the response.
|
||||
let response = response
|
||||
.map_err(|_| Msg::AppointmentsSent(RequestState::Error))?
|
||||
@@ -17,7 +17,7 @@ pub async fn fetch_teachers() -> Result<Msg, Msg> {
|
||||
|
||||
pub async fn fetch_slots() -> Result<Msg, Msg> {
|
||||
// Send the request to the specified URL.
|
||||
let response = Request::new("/get/slots").send().await;
|
||||
let response = Request::get("/get/slots/1").send().await;
|
||||
// Return the ZuordnungMessage with the given network object and the response.
|
||||
let response = response
|
||||
.map_err(|_| Msg::AppointmentsSent(RequestState::Error))?
|
||||
@@ -29,7 +29,7 @@ pub async fn fetch_slots() -> Result<Msg, Msg> {
|
||||
|
||||
pub async fn fetch_unavailable() -> Result<Msg, Msg> {
|
||||
// Send the request to the specified URL.
|
||||
let response = Request::new("/get/unavailable").send().await;
|
||||
let response = Request::get("/get/unavailable").send().await;
|
||||
// Return the ZuordnungMessage with the given network object and the response.
|
||||
let response = response
|
||||
.map_err(|_| Msg::AppointmentsSent(RequestState::Error))?
|
||||
@@ -43,8 +43,7 @@ pub async fn send_appointments(
|
||||
appointments: Vec<PlannedAppointment>,
|
||||
nutzer: Nutzer,
|
||||
) -> Result<Msg, Msg> {
|
||||
let response = Request::new("/send/appointments")
|
||||
.method(Method::POST)
|
||||
let response = Request::post("/send/appointments")
|
||||
.json(&(&appointments, &nutzer))
|
||||
.map_err(|_| Msg::AppointmentsSent(RequestState::Error))?
|
||||
.send()
|
||||
|
||||
Reference in New Issue
Block a user