implemented get all shares

This commit is contained in:
2022-05-14 23:25:50 +02:00
parent f31f1bbf02
commit 508e109734
4 changed files with 37 additions and 0 deletions

View File

@@ -62,6 +62,16 @@ func StartWebserver(addr string, client client.Client, username, password string
return
}
shares, err := client.GetAllShares(r.Context())
if err != nil {
logrus.Error(err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(shares)
}).Methods("GET")
r.HandleFunc("/api/share", func(w http.ResponseWriter, r *http.Request) {