Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Roma7-7-7 committed Jan 23, 2024
1 parent 48274f7 commit ac08561
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion configs/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dev": true,
"port": 8080,
"cors": {
"allow_origins": ["http://localhost"],
"allow_origins": ["http://localhost:5173"],
"allow_methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
"allow_headers": ["Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization", "If-Modified-Since"],
"expose_headers": ["Location"],
Expand Down
14 changes: 7 additions & 7 deletions internal/handler/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ type genericErrorResponse struct {
}

func badRequestErrorBody(message string) []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorBadRequest, message))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorBadRequest.Value, message))
}

func notFoundErrorBody(message string) []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeNotFound, message))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeNotFound.Value, message))
}

func unauthorizedErrorBody(message string) []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeUnauthorized, message))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeUnauthorized.Value, message))
}

func forbiddenErrorBody(message string) []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeForbidden, message))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeForbidden.Value, message))
}

func methodNotAllowedErrorBody(method string) []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeMethodNotAllowed, fmt.Sprintf("Method %s is not allowed", method)))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeMethodNotAllowed.Value, fmt.Sprintf("Method %s is not allowed", method)))
}

func internalServerErrorBody() []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeInternalServerError, "Internal server error"))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeInternalServerError.Value, "Internal server error"))
}

func marshalErrorBody() []byte {
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeMarshalResponse, "Failed to marshal response"))
return []byte(fmt.Sprintf(errorResponseTmpl, domain.ErrorCodeMarshalResponse.Value, "Failed to marshal response"))
}

func sendBadRequest(ctx context.Context, rw http.ResponseWriter, message string, log log.TracedLogger) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Navbar() {
}

const signInTitle = "Sign In";
const defaultPasswordFeedback = "Password must be at least 8 characters long and contain at least one upper case letter, at least one lower case, one number and one special character";
const defaultPasswordFeedback = "Password must be at least 8 chara¡cters long and contain at least one upper case letter, at least one lower case, one number and one special character";

function AuthModal({show, onHide, title}) {
const isSignUp = title !== signInTitle;
Expand Down

0 comments on commit ac08561

Please sign in to comment.