mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-14 15:43:52 +02:00
feat:#34 refactored function to intended service, fixed docker files
This commit is contained in:
@@ -2,12 +2,13 @@ package connector
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v3/client"
|
||||
"htwkalender-ical/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RequestApi(path string) (*client.Response, error) {
|
||||
const host = "http://127.0.0.1:8090"
|
||||
|
||||
var host = "http://htwkalender-backend:8090"
|
||||
func RequestApi(path string) (*client.Response, error) {
|
||||
|
||||
cc := client.New()
|
||||
cc.SetTimeout(5 * time.Second)
|
||||
@@ -23,8 +24,6 @@ func RequestApi(path string) (*client.Response, error) {
|
||||
|
||||
func DeleteRequestApi(path string) error {
|
||||
|
||||
var host = "http://htwkalender-backend:8090"
|
||||
|
||||
cc := client.New()
|
||||
cc.SetTimeout(5 * time.Second)
|
||||
|
||||
@@ -36,3 +35,25 @@ func DeleteRequestApi(path string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func PostRequestApi(path string, body []model.FeedCollection) (*client.Response, error) {
|
||||
|
||||
cc := client.New()
|
||||
cc.SetTimeout(5 * time.Second)
|
||||
|
||||
config := client.Config{
|
||||
Body: body,
|
||||
Header: map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "*/*",
|
||||
},
|
||||
}
|
||||
|
||||
// set retry to 0
|
||||
response, err := cc.Post(host+path, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user