Skip to content

Commit

Permalink
Redirect / to /ui
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Apr 18, 2024
1 parent 803d14e commit b13e74a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion backend/my_app_api/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import logging

Check failure on line 1 in backend/my_app_api/routes/__init__.py

View workflow job for this annotation

GitHub Actions / Style tests (backend)

Imports are incorrectly sorted and/or formatted.

from fastapi import FastAPI
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi_sqlalchemy import DBSessionMiddleware
from fastapi.responses import RedirectResponse
from starlette.datastructures import URL
from my_app_api import __version__
from my_app_api.settings import get_settings

Expand Down Expand Up @@ -34,4 +36,14 @@
allow_headers=settings.CORS_ALLOW_HEADERS,
)


@app.get("/")
def redirect(request: Request):
url = URL(
path='/ui/',
query=request.url.components.query,
fragment=request.url.components.fragment,
)
return RedirectResponse(url)

app.include_router(touch_router)
7 changes: 6 additions & 1 deletion frontend/src/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ const makeClick = async () => {
}
clickResult.value = +data.count;
};
const location = document.location.origin + "/docs/";
</script>

<template>
<div>
<h1 class="text-h1">
Hello<span v-if="profileStore.full_name">, {{ profileStore.full_name }}</span
Привет<span v-if="profileStore.full_name">, {{ profileStore.full_name }}</span
>!
</h1>
<p v-if="!profileStore.full_name">
Expand All @@ -80,5 +82,8 @@ const makeClick = async () => {
В сумме ты кликнул эту кнопку <span>{{ clickResult }}</span> раз
</h2>
</div>
<div>
<p>Документация к этому коду находится по адресу <a href="/docs/">{{ location }}</a></p>
</div>
</div>
</template>

0 comments on commit b13e74a

Please sign in to comment.