feat: login service and implement database storage
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ResponseWithErrorCode(ctx context.Context, w http.ResponseWriter,
|
||||
err error, code string, statusCode int, message string) {
|
||||
setDefaultHeaders(ctx, w.Header())
|
||||
|
||||
w.WriteHeader(statusCode)
|
||||
|
||||
b, _ := json.Marshal(ErrorResponse{
|
||||
Error: ErrorResponseData{
|
||||
Code: code,
|
||||
Message: message,
|
||||
},
|
||||
})
|
||||
|
||||
w.Write(b)
|
||||
}
|
||||
Reference in New Issue
Block a user