Seperate API from UI

This commit is contained in:
video-prize-ranch
2023-01-01 15:12:03 -05:00
parent e03abd0ab9
commit a3feae6b30
11 changed files with 79 additions and 58 deletions

View File

@@ -16,11 +16,11 @@ func HandleEmbed(c *fiber.Ctx) error {
post, err := api.Album{}, error(nil)
switch {
case strings.HasPrefix(c.Path(), "/a"):
post, err = api.FetchAlbum(c.Params("postID"))
post, err = ApiClient.FetchAlbum(c.Params("postID"))
case strings.HasPrefix(c.Path(), "/gallery"):
post, err = api.FetchPosts(c.Params("postID"))
post, err = ApiClient.FetchPosts(c.Params("postID"))
default:
post, err = api.FetchMedia(c.Params("postID"))
post, err = ApiClient.FetchMedia(c.Params("postID"))
}
if err != nil && err.Error() == "ratelimited by imgur" {
return c.Status(429).Render("errors/429", nil)