mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-14 15:43:52 +02:00
feat:#7 added new folder structure and updated api in ical
This commit is contained in:
38
services/ical/service/connector/restHandler.go
Normal file
38
services/ical/service/connector/restHandler.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package connector
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v3/client"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RequestApi(path string) (*client.Response, error) {
|
||||
|
||||
var host = "http://htwkalender-backend:8090"
|
||||
|
||||
cc := client.New()
|
||||
cc.SetTimeout(5 * time.Second)
|
||||
|
||||
// set retry to 0
|
||||
response, err := cc.Get(host + path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func DeleteRequestApi(path string) error {
|
||||
|
||||
var host = "http://htwkalender-backend:8090"
|
||||
|
||||
cc := client.New()
|
||||
cc.SetTimeout(5 * time.Second)
|
||||
|
||||
// set retry to 0
|
||||
_, err := cc.Delete(host + path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user