fix: weird bug
cutt.0124816.xyz/team responded with 404 while all other routes were handled correctly by react-router
This commit is contained in:
parent
0507b9f7c4
commit
11f3f9f440
17
cutt/main.py
17
cutt/main.py
@ -1,6 +1,6 @@
|
||||
from typing import Annotated
|
||||
from fastapi import APIRouter, Depends, FastAPI, HTTPException, Security, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.responses import FileResponse, JSONResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from cutt.db import Player, Team, Chemistry, MVPRanking, engine
|
||||
from sqlmodel import (
|
||||
@ -179,4 +179,17 @@ api_router.add_api_route("/token", endpoint=login_for_access_token, methods=["PO
|
||||
api_router.add_api_route("/set_password", endpoint=set_first_password, methods=["POST"])
|
||||
api_router.add_api_route("/logout", endpoint=logout, methods=["POST"])
|
||||
app.include_router(api_router)
|
||||
app.mount("/", SPAStaticFiles(directory="dist", html=True), name="site")
|
||||
|
||||
|
||||
# app.mount("/", SPAStaticFiles(directory="dist", html=True), name="site")
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return FileResponse("dist/index.html")
|
||||
|
||||
|
||||
@app.exception_handler(404)
|
||||
async def exception_404_handler(request, exc):
|
||||
return FileResponse("dist/index.html")
|
||||
|
||||
|
||||
app.mount("/", StaticFiles(directory="dist"), name="ui")
|
||||
|
Loading…
x
Reference in New Issue
Block a user