github.com/germla/auth@v0.0.0-20230505173936-bc9a4159cf17/redirector.go (about)

     1  package auth
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/qor/redirect_back"
     7  )
     8  
     9  // RedirectorInterface redirector interface
    10  type RedirectorInterface interface {
    11  	// Redirect redirect after action
    12  	Redirect(w http.ResponseWriter, req *http.Request, action string)
    13  }
    14  
    15  // Redirector default redirector
    16  type Redirector struct {
    17  	*redirect_back.RedirectBack
    18  }
    19  
    20  // Redirect redirect back after action
    21  func (redirector Redirector) Redirect(w http.ResponseWriter, req *http.Request, action string) {
    22  	redirector.RedirectBack.RedirectBack(w, req)
    23  }