Skip to content

Commit

Permalink
fix frontend connection to api auth and cors
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden committed Jun 4, 2024
1 parent 7f343fa commit ed9e15c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/auth/EmailAuthComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const EmailAuthComponent = () => {
await api.post<boolean>("/users/login", {
email,
login_url,
// 7 days
lifetime: 60 * 60 * 24 * 7,
});
setIsSuccess(true);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion store/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def redirect_to_index(full_path: str, request: Request) -> Response:
# Adds CORS middleware.
app.add_middleware(
CORSMiddleware,
allow_origins=[settings.site.homepage, settings.site.api],
allow_origins=[settings.site.homepage],
allow_credentials=True,
allow_methods=["GET", "POST", "DELETE", "OPTIONS"],
allow_headers=["*"],
Expand Down
3 changes: 1 addition & 2 deletions store/settings/configs/local.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
crypto:
jwt_secret: fakeJwtSecret
site:
homepage: http://localhost:3000
api: http://localhost:8080
homepage: http://127.0.0.1:3000
1 change: 0 additions & 1 deletion store/settings/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class EmailSettings:
@dataclass
class SiteSettings:
homepage: str = field(default=MISSING)
api: str = field(default=MISSING)
image_url: str | None = field(default=None)


Expand Down

0 comments on commit ed9e15c

Please sign in to comment.