fix: add debug labels

This commit is contained in:
swve 2022-09-24 14:35:26 +02:00
parent 3b85a73ec1
commit c5bb590b2d
4 changed files with 23 additions and 6 deletions

View file

@ -9,7 +9,9 @@ export const HeaderProfileBox = () => {
return ( return (
<ProfileArea> <ProfileArea>
{" "} {" "}
<span>HeaderProfileBox {String(auth.isAuthenticated)}</span>{" "} <span>
HeaderProfileBox <br /> isLogged : {String(auth.isAuthenticated)} <br /> user : {String(auth.userInfo.username)}
</span>{" "}
<UnidentifiedArea> <UnidentifiedArea>
<ul> <ul>
<li> <li>
@ -41,7 +43,8 @@ const ProfileArea = styled.div`
padding: 6px; padding: 6px;
font-size: 12px; font-size: 12px;
margin: 3px; margin: 3px;
background-color: #19191939; // blur
background-color: #19191960;
border-radius: 5px; border-radius: 5px;
color: white; color: white;
width: auto; width: auto;

View file

@ -1,12 +1,26 @@
import React from "react"; import React from "react";
import { Menu } from "./elements/menu"; import { Menu } from "./elements/menu";
import Link from 'next/link' import Link from 'next/link'
import styled from "styled-components";
export const Header = () => { export const Header = () => {
return ( return (
<div> <div>
<Menu></Menu> <Menu></Menu>
<PreAlphaLabel>🚧 Pre-Alpha</PreAlphaLabel>
</div> </div>
); );
}; };
const PreAlphaLabel = styled.div`
position: fixed;
bottom: 0;
right: 0;
padding: 9px;
background-color: #080501;
color: white;
font-size: 19px;
font-weight: bold;
border-radius: 5px 0 0 0px;
`;

View file

@ -4,7 +4,7 @@ from pydantic import BaseModel
from src.services.auth import * from src.services.auth import *
from src.services.users import * from src.services.users import *
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/token")
router = APIRouter() router = APIRouter()
@ -18,7 +18,7 @@ async def api_get_current_user(current_user: User = Depends(get_current_user)):
return current_user.dict() return current_user.dict()
@router.get("/profile") @router.get("/profile")
async def api_get_current_user(current_user: User = Depends(get_current_user_jwt)): async def api_get_current_user(current_user: User = Depends(get_current_user)):
""" """
Get current user Get current user
""" """

View file

@ -62,7 +62,7 @@ def create_access_token(data: dict, expires_delta: timedelta | None = None):
return encoded_jwt return encoded_jwt
# DEPRECATED # DEPRECATED
async def get_current_user(token: str = Depends(oauth2_scheme)): async def get_current_user_old(token: str = Depends(oauth2_scheme)):
credentials_exception = HTTPException( credentials_exception = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials", detail="Could not validate credentials",
@ -82,7 +82,7 @@ async def get_current_user(token: str = Depends(oauth2_scheme)):
return PublicUser(**user.dict()) return PublicUser(**user.dict())
async def get_current_user_jwt(Authorize: AuthJWT = Depends()): async def get_current_user(Authorize: AuthJWT = Depends()):
credentials_exception = HTTPException( credentials_exception = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials", detail="Could not validate credentials",