feat: implement service history view and tracking
This commit is contained in:
@@ -91,3 +91,23 @@ func UnlockService(serviceName, user string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetHistory(serviceName string) ([]models.HistoryEntry, error) {
|
||||
req, err := http.NewRequest("GET", baseURL+"/history?service="+serviceName, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("X-API-Key", apiToken)
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
var history []models.HistoryEntry
|
||||
if err := json.NewDecoder(resp.Body).Decode(&history); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return history, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user