Исправление mixed content

This commit is contained in:
2025-12-22 11:50:55 +03:00
parent 4b06c4fb1f
commit 1141cf5e66
2 changed files with 11 additions and 6 deletions
+4 -4
View File
@@ -96,10 +96,10 @@ async def book(request: Request, book_id: int):
return templates.TemplateResponse(request, "book.html")
@router.get("/auth", include_in_schema=False)
async def auth(request: Request):
"""Эндпоинт страницы авторизации"""
return templates.TemplateResponse(request, "auth.html")
@router.get("/auth", include_in_schema=False)
async def auth(request: Request):
"""Эндпоинт страницы авторизации"""
return templates.TemplateResponse(request, "auth.html")
@router.get("/profile", include_in_schema=False)
+7 -2
View File
@@ -53,7 +53,12 @@ const Utils = {
};
const Api = {
getBaseUrl() {
return window.location.origin;
},
async request(endpoint, options = {}) {
const fullUrl = this.getBaseUrl() + endpoint;
const token = localStorage.getItem("access_token");
const headers = {
"Content-Type": "application/json",
@@ -67,14 +72,14 @@ const Api = {
const config = { ...options, headers };
try {
const response = await fetch(endpoint, config);
const response = await fetch(fullUrl, config);
if (response.status === 401) {
const refreshed = await Auth.tryRefresh();
if (refreshed) {
headers["Authorization"] =
`Bearer ${localStorage.getItem("access_token")}`;
const retryResponse = await fetch(endpoint, { ...options, headers });
const retryResponse = await fetch(fullUrl, { ...options, headers });
if (retryResponse.ok) {
return retryResponse.json();
}