Skip to content

Commit

Permalink
fix: jwt_token blank (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhunter2333 authored May 29, 2023
1 parent 562c68b commit f8d0813
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const fetchSettings = async () => {
const response = await fetch(`${API_BASE}/api/v1/settings`, {
method: "GET",
headers: {
Authorization: `Bearer ${state_jwt.value || "xxx"}`,
"Authorization": `Bearer ${state_jwt.value || "xxx"}`,
"Content-Type": "application/json"
},
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const onSubmit = async () => {
plum_flower: prompt_type.value == "plum_flower" ? plum_flower.value : null,
}),
headers: {
Authorization: `Bearer ${state_jwt.value || "xxx"}`,
"Authorization": `Bearer ${state_jwt.value || "xxx"}`,
"Content-Type": "application/json"
},
});
Expand Down
4 changes: 2 additions & 2 deletions router/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def get_user(
) -> Optional[User]:
try:
jwt_token = credentials.credentials
if jwt_token == DEFAULT_TOKEN:
return ""
if not jwt_token or jwt_token == DEFAULT_TOKEN:
return
payload = jwt.decode(
jwt_token, settings.jwt_secret, algorithms=["HS256"])
jwt_payload = User.parse_obj(payload)
Expand Down

0 comments on commit f8d0813

Please sign in to comment.