Skip to content

Commit

Permalink
Update AuthwithToken 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fchrgrib committed Jun 15, 2023
1 parent 5eeeea0 commit 34e39ac
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion controllers/profile/UpdatePhotoProfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ func UpdatePhotoProfile(c *gin.Context, router *gin.Engine) {

if fileStat.Size() != 0 {
rProfile := router.Group("photo_profile")
rProfile.Use(middleware.AuthWithToken)
rProfile.Use(func(c *gin.Context) {
middleware.AuthWithToken(c)
})
rProfile.GET(uid, func(c *gin.Context) {
c.File(path)
})
Expand Down
2 changes: 1 addition & 1 deletion controllers/profile/UploadPhotoProfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func PhotoProfileUpload(c *gin.Context, router *gin.Engine) {

if fileStat.Size() != 0 {
rProfile := router.Group("photo_profile")
rProfile.Use(func(context *gin.Context) {
rProfile.Use(func(c *gin.Context) {
middleware.AuthWithToken(c)
})
rProfile.GET(uid, func(c *gin.Context) {
Expand Down
4 changes: 3 additions & 1 deletion controllers/wallpaperpage/UploadWallpaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func UploadWallpaper(c *gin.Context, router *gin.Engine) {
if fileStat.Size() != 0 {

rImage := router.Group("/images")
rImage.Use(middleware.AuthWithToken)
rImage.Use(func(c *gin.Context) {
middleware.AuthWithToken(c)
})
rImage.GET(uid, func(c *gin.Context) {
c.File(path)
})
Expand Down
4 changes: 3 additions & 1 deletion handlers/routers/Images.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
func Images(routers *gin.Engine) {

rImage := routers.Group("/images")
rImage.Use(middleware.AuthWithToken)
rImage.Use(func(c *gin.Context) {
middleware.AuthWithToken(c)
})
rImage.GET("/:id/download", wallpaperpage.DownloadWallpaper)
rImage.DELETE("/:id/delete", wallpaperpage.DeleteWallpaperController)

Expand Down
1 change: 0 additions & 1 deletion libs/middleware/AutWithToken.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func AuthWithToken(c *gin.Context) {

if err != nil {
c.AbortWithStatus(http.StatusUnauthorized)
println("Salah disini tot tapi gatau kenapa ini tokennya \n" + _token + "\n ini errornya " + err.Error())
return
}

Expand Down

3 comments on commit 34e39ac

@vercel
Copy link

@vercel vercel bot commented on 34e39ac Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 34e39ac Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 34e39ac Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.