mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-16 11:12:25 +01:00
39 lines
601 B
Go
39 lines
601 B
Go
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
|
|
}
|