diff --git a/handler/index_and_404.go b/handler/index_and_404.go index 796bdcb..57e2229 100644 --- a/handler/index_and_404.go +++ b/handler/index_and_404.go @@ -36,7 +36,7 @@ func (handler IndexHandlerImpl) handle(router *http.ServeMux) { func (handler IndexHandlerImpl) handleIndexAnd404() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - user, err := handler.service.GetUserFromSessionId(utils.GetSessionID(r)) + user, _ := handler.service.GetUserFromSessionId(utils.GetSessionID(r)) var comp templ.Component = nil userComp := service.UserInfoComp(user) @@ -48,7 +48,7 @@ func (handler IndexHandlerImpl) handleIndexAnd404() http.HandlerFunc { comp = template.Layout(template.Index(), userComp, handler.serverSettings.Environment) } - err = comp.Render(r.Context(), w) + err := comp.Render(r.Context(), w) if err != nil { utils.LogError("Failed to render index", err) http.Error(w, "Failed to render index", http.StatusInternalServerError) diff --git a/service/auth.go b/service/auth.go index 8d7fc10..5137019 100644 --- a/service/auth.go +++ b/service/auth.go @@ -24,11 +24,11 @@ import ( ) var ( - ErrInvaidCredentials = errors.New("Invalid email or password") - ErrInvalidPassword = errors.New("Password needs to be 8 characters long, contain at least one number, one special, one uppercase and one lowercase character") - ErrInvalidEmail = errors.New("Invalid email") - ErrAccountExists = errors.New("Account already exists") - ErrSessionIdInvalid = errors.New("Session ID is invalid") + ErrInvaidCredentials = errors.New("invalid email or password") + ErrInvalidPassword = errors.New("password needs to be 8 characters long, contain at least one number, one special, one uppercase and one lowercase character") + ErrInvalidEmail = errors.New("invalid email") + ErrAccountExists = errors.New("account already exists") + ErrSessionIdInvalid = errors.New("session ID is invalid") ) type User struct { diff --git a/service/workout.go b/service/workout.go index 97d0b1e..f8b6776 100644 --- a/service/workout.go +++ b/service/workout.go @@ -61,7 +61,7 @@ func NewWorkoutDto(rowId string, date string, workoutType string, sets string, r } var ( - ErrInputValues = errors.New("Invalid input values") + ErrInputValues = errors.New("invalid input values") ) func (service WorkoutServiceImpl) AddWorkout(user *User, workoutDto *WorkoutDto) (*WorkoutDto, error) { @@ -125,15 +125,6 @@ func (service WorkoutServiceImpl) GetWorkouts(user *User) ([]*WorkoutDto, error) return workoutsDto, nil } -func renderDateStr(date string) (string, error) { - t, err := time.Parse("2006-01-02 15:04:05-07:00", date) - if err != nil { - return "", err - } - - return renderDate(t), nil -} - func renderDate(date time.Time) string { return date.Format("2006-01-02") } diff --git a/types/types.go b/types/types.go index 7c1b413..c2c9acd 100644 --- a/types/types.go +++ b/types/types.go @@ -5,5 +5,5 @@ import ( ) var ( - ErrInternal = errors.New("Internal server error") + ErrInternal = errors.New("internal server error") )