mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 15:55:26 +02:00
added OverviewRoute.tsx; updated API urls
This commit is contained in:
parent
964ee90d50
commit
29f187320b
@ -18,6 +18,10 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"routes": {
|
"routes": {
|
||||||
|
"OverviewRoute": {
|
||||||
|
"title": "Overview",
|
||||||
|
"description": "Not much to see here, yet."
|
||||||
|
},
|
||||||
"LoginRoute": {
|
"LoginRoute": {
|
||||||
"forms": {
|
"forms": {
|
||||||
"email": {
|
"email": {
|
||||||
|
@ -24,6 +24,7 @@ import SettingsRoute from "~/routes/SettingsRoute"
|
|||||||
import SignupRoute from "~/routes/SignupRoute"
|
import SignupRoute from "~/routes/SignupRoute"
|
||||||
import VerifyEmailRoute from "~/routes/VerifyEmailRoute"
|
import VerifyEmailRoute from "~/routes/VerifyEmailRoute"
|
||||||
|
|
||||||
|
import OverviewRoute from "~/routes/OverviewRoute"
|
||||||
import "./init-i18n"
|
import "./init-i18n"
|
||||||
|
|
||||||
const router = createBrowserRouter([
|
const router = createBrowserRouter([
|
||||||
@ -65,6 +66,10 @@ const router = createBrowserRouter([
|
|||||||
path: "/",
|
path: "/",
|
||||||
element: <AuthenticatedRoute />,
|
element: <AuthenticatedRoute />,
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <OverviewRoute />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
loader: getServerSettings,
|
loader: getServerSettings,
|
||||||
path: "/aliases",
|
path: "/aliases",
|
||||||
|
@ -15,7 +15,7 @@ export default async function changeAllowEmailLoginFromDifferentDevices({
|
|||||||
const {data} = await client.patch(
|
const {data} = await client.patch(
|
||||||
`${
|
`${
|
||||||
import.meta.env.VITE_SERVER_BASE_URL
|
import.meta.env.VITE_SERVER_BASE_URL
|
||||||
}/auth/login/email-token/allow-login-from-different-devices`,
|
}/v1/auth/login/email-token/allow-login-from-different-devices`,
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
sameRequestToken,
|
sameRequestToken,
|
||||||
|
@ -30,9 +30,13 @@ interface CreateAliasDataCustomType extends CreateAliasDataBase {
|
|||||||
export type CreateAliasData = CreateAliasDataRandomType | CreateAliasDataCustomType
|
export type CreateAliasData = CreateAliasDataRandomType | CreateAliasDataCustomType
|
||||||
|
|
||||||
export default async function createAlias(aliasData: CreateAliasData): Promise<Alias> {
|
export default async function createAlias(aliasData: CreateAliasData): Promise<Alias> {
|
||||||
const {data} = await client.post(`${import.meta.env.VITE_SERVER_BASE_URL}/alias`, aliasData, {
|
const {data} = await client.post(
|
||||||
withCredentials: true,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/alias`,
|
||||||
})
|
aliasData,
|
||||||
|
{
|
||||||
|
withCredentials: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import {SimpleDetailResponse} from "~/server-types"
|
|||||||
import {client} from "~/constants/axios-client"
|
import {client} from "~/constants/axios-client"
|
||||||
|
|
||||||
export default async function deleteReport(id: string): Promise<SimpleDetailResponse> {
|
export default async function deleteReport(id: string): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.delete(`${import.meta.env.VITE_SERVER_BASE_URL}/report/${id}`, {
|
const {data} = await client.delete(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/report/${id}`, {
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,12 +2,9 @@ import {client} from "~/constants/axios-client"
|
|||||||
import {Alias} from "~/server-types"
|
import {Alias} from "~/server-types"
|
||||||
|
|
||||||
export default async function getAlias(address: string): Promise<Alias> {
|
export default async function getAlias(address: string): Promise<Alias> {
|
||||||
const {data} = await client.get(
|
const {data} = await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/alias/${address}`, {
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/alias/${address}`,
|
withCredentials: true,
|
||||||
{
|
})
|
||||||
withCredentials: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -10,17 +10,14 @@ export default async function getAliases({
|
|||||||
size,
|
size,
|
||||||
page,
|
page,
|
||||||
}: GetAliasesData): Promise<PaginationResult<AliasList>> {
|
}: GetAliasesData): Promise<PaginationResult<AliasList>> {
|
||||||
const {data} = await client.get(
|
const {data} = await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/alias`, {
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/alias`,
|
withCredentials: true,
|
||||||
{
|
params: {
|
||||||
withCredentials: true,
|
query,
|
||||||
params: {
|
size,
|
||||||
query,
|
page,
|
||||||
size,
|
|
||||||
page,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@ import {client} from "~/constants/axios-client"
|
|||||||
import {Report} from "~/server-types"
|
import {Report} from "~/server-types"
|
||||||
|
|
||||||
export default async function getReport(id: string): Promise<Report> {
|
export default async function getReport(id: string): Promise<Report> {
|
||||||
const {data} = await client.get(
|
const {data} = await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/report/${id}`, {
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/report/${id}`,
|
withCredentials: true,
|
||||||
{
|
})
|
||||||
withCredentials: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@ import {PaginationResult, Report} from "~/server-types"
|
|||||||
import {client} from "~/constants/axios-client"
|
import {client} from "~/constants/axios-client"
|
||||||
|
|
||||||
export default async function getReports(): Promise<PaginationResult<Report>> {
|
export default async function getReports(): Promise<PaginationResult<Report>> {
|
||||||
const {data} = await client.get(
|
const {data} = await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/report`, {
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/report`,
|
withCredentials: true,
|
||||||
{
|
})
|
||||||
withCredentials: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,5 @@ import {ServerSettings} from "~/server-types"
|
|||||||
import {client} from "~/constants/axios-client"
|
import {client} from "~/constants/axios-client"
|
||||||
|
|
||||||
export default async function getServerSettings(): Promise<ServerSettings> {
|
export default async function getServerSettings(): Promise<ServerSettings> {
|
||||||
return (
|
return (await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/settings`)).data
|
||||||
await client.get(`${import.meta.env.VITE_SERVER_BASE_URL}/settings`)
|
|
||||||
).data
|
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,9 @@ export interface LoginWithEmailResult {
|
|||||||
sameRequestToken: string
|
sameRequestToken: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function loginWithEmail(
|
export default async function loginWithEmail(email: string): Promise<LoginWithEmailResult> {
|
||||||
email: string,
|
|
||||||
): Promise<LoginWithEmailResult> {
|
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/login/email-token`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/login/email-token`,
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import {MinimumServerResponse} from "~/server-types"
|
|
||||||
import {client} from "~/constants/axios-client"
|
import {client} from "~/constants/axios-client"
|
||||||
|
import {SimpleDetailResponse} from "~/server-types"
|
||||||
|
|
||||||
export default async function logout(): Promise<SimpleDetailResponse> {
|
export default async function logout(): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/logout`)
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/logout`,
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,7 @@ export interface RefreshTokenResult {
|
|||||||
detail: string
|
detail: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const REFRESH_TOKEN_URL = `${
|
export const REFRESH_TOKEN_URL = `${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/refresh`
|
||||||
import.meta.env.VITE_SERVER_BASE_URL
|
|
||||||
}/auth/refresh`
|
|
||||||
|
|
||||||
export default async function refreshToken(): Promise<RefreshTokenResult> {
|
export default async function refreshToken(): Promise<RefreshTokenResult> {
|
||||||
const {data} = await client.post(REFRESH_TOKEN_URL)
|
const {data} = await client.post(REFRESH_TOKEN_URL)
|
||||||
|
@ -11,9 +11,7 @@ export default async function resendEmailLoginCode({
|
|||||||
sameRequestToken,
|
sameRequestToken,
|
||||||
}: ResendEmailLoginCodeData): Promise<SimpleDetailResponse> {
|
}: ResendEmailLoginCodeData): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(
|
||||||
`${
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/login/email-token/resend-email`,
|
||||||
import.meta.env.VITE_SERVER_BASE_URL
|
|
||||||
}/auth/login/email-token/resend-email`,
|
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
sameRequestToken,
|
sameRequestToken,
|
||||||
|
@ -5,7 +5,7 @@ export default async function resendEmailVerificationCode(
|
|||||||
email: string,
|
email: string,
|
||||||
): Promise<SimpleDetailResponse> {
|
): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/resend-email`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/resend-email`,
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
},
|
},
|
||||||
|
@ -5,12 +5,9 @@ export interface SignupResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function signup(email: string): Promise<SignupResult> {
|
export default async function signup(email: string): Promise<SignupResult> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/signup`, {
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/signup`,
|
email,
|
||||||
{
|
})
|
||||||
email,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export default async function updateAccount(
|
|||||||
updateData: UpdateAccountData,
|
updateData: UpdateAccountData,
|
||||||
): Promise<AuthenticationDetails> {
|
): Promise<AuthenticationDetails> {
|
||||||
const {data} = await client.patch(
|
const {data} = await client.patch(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/account`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/account`,
|
||||||
updateData,
|
updateData,
|
||||||
{
|
{
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
@ -13,7 +13,7 @@ export interface UpdateAliasData {
|
|||||||
|
|
||||||
export default async function updateAlias(id: string, updateData: UpdateAliasData): Promise<Alias> {
|
export default async function updateAlias(id: string, updateData: UpdateAliasData): Promise<Alias> {
|
||||||
const {data} = await client.patch(
|
const {data} = await client.patch(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/alias/${id}`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/alias/${id}`,
|
||||||
updateData,
|
updateData,
|
||||||
{
|
{
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
@ -13,7 +13,7 @@ export default async function updatePreferences(
|
|||||||
updateData: UpdatePreferencesData,
|
updateData: UpdatePreferencesData,
|
||||||
): Promise<SimpleDetailResponse> {
|
): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.patch(
|
const {data} = await client.patch(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/preferences`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/preferences`,
|
||||||
updateData,
|
updateData,
|
||||||
{
|
{
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
@ -12,7 +12,7 @@ export default async function verifyEmail({
|
|||||||
token,
|
token,
|
||||||
}: VerifyEmailData): Promise<AuthenticationDetails> {
|
}: VerifyEmailData): Promise<AuthenticationDetails> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/verify-email`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/verify-email`,
|
||||||
{
|
{
|
||||||
email: email,
|
email: email,
|
||||||
token: token,
|
token: token,
|
||||||
|
@ -14,7 +14,7 @@ export default async function verifyLoginWithEmail({
|
|||||||
sameRequestToken,
|
sameRequestToken,
|
||||||
}: VerifyLoginWithEmailData): Promise<AuthenticationDetails> {
|
}: VerifyLoginWithEmailData): Promise<AuthenticationDetails> {
|
||||||
const {data} = await client.post(
|
const {data} = await client.post(
|
||||||
`${import.meta.env.VITE_SERVER_BASE_URL}/auth/login/email-token/verify`,
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/auth/login/email-token/verify`,
|
||||||
{
|
{
|
||||||
email,
|
email,
|
||||||
token,
|
token,
|
||||||
|
@ -3,11 +3,12 @@ import {BiStats} from "react-icons/bi"
|
|||||||
import {MdSettings} from "react-icons/md"
|
import {MdSettings} from "react-icons/md"
|
||||||
import {FaMask} from "react-icons/fa"
|
import {FaMask} from "react-icons/fa"
|
||||||
import {Link as RouterLink, useLocation} from "react-router-dom"
|
import {Link as RouterLink, useLocation} from "react-router-dom"
|
||||||
|
import {useTranslation} from "react-i18next"
|
||||||
|
|
||||||
import {Button} from "@mui/material"
|
import {Button} from "@mui/material"
|
||||||
import {mdiTextBoxMultiple} from "@mdi/js/commonjs/mdi"
|
import {mdiTextBoxMultiple} from "@mdi/js/commonjs/mdi"
|
||||||
import {useTranslation} from "react-i18next"
|
|
||||||
import Icon from "@mdi/react"
|
import Icon from "@mdi/react"
|
||||||
|
|
||||||
import LockNavigationContext from "~/LockNavigationContext/LockNavigationContext"
|
import LockNavigationContext from "~/LockNavigationContext/LockNavigationContext"
|
||||||
|
|
||||||
export enum NavigationSection {
|
export enum NavigationSection {
|
||||||
@ -42,9 +43,7 @@ const PATH_SECTION_MAP: Record<string, NavigationSection> = {
|
|||||||
settings: NavigationSection.Settings,
|
settings: NavigationSection.Settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NavigationButton({
|
export default function NavigationButton({section}: NavigationButtonProps): ReactElement {
|
||||||
section,
|
|
||||||
}: NavigationButtonProps): ReactElement {
|
|
||||||
const {t} = useTranslation()
|
const {t} = useTranslation()
|
||||||
const {handleAnchorClick} = useContext(LockNavigationContext)
|
const {handleAnchorClick} = useContext(LockNavigationContext)
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
@ -61,9 +60,8 @@ export default function NavigationButton({
|
|||||||
startIcon={Icon}
|
startIcon={Icon}
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
to={
|
to={
|
||||||
Object.keys(PATH_SECTION_MAP).find(
|
Object.keys(PATH_SECTION_MAP).find(path => PATH_SECTION_MAP[path] === section) ??
|
||||||
path => PATH_SECTION_MAP[path] === section,
|
"/"
|
||||||
) ?? "/"
|
|
||||||
}
|
}
|
||||||
onClick={handleAnchorClick}
|
onClick={handleAnchorClick}
|
||||||
>
|
>
|
||||||
|
20
src/routes/OverviewRoute.tsx
Normal file
20
src/routes/OverviewRoute.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import {ReactElement} from "react"
|
||||||
|
import {useTranslation} from "react-i18next"
|
||||||
|
|
||||||
|
import {Grid, Typography} from "@mui/material"
|
||||||
|
|
||||||
|
import {SimplePage} from "~/components"
|
||||||
|
|
||||||
|
export default function OverviewRoute(): ReactElement {
|
||||||
|
const {t} = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SimplePage title={t("routes.OverviewRoute.title")}>
|
||||||
|
<Grid container>
|
||||||
|
<Grid item>
|
||||||
|
<Typography variant="body1">{t("routes.OverviewRoute.description")}</Typography>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</SimplePage>
|
||||||
|
)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user