mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 15:55:26 +02:00
improved aliases page
This commit is contained in:
parent
2083c0bdb6
commit
9645e18b6a
@ -15,7 +15,7 @@ export interface CreateRandomAliasButtonProps {
|
|||||||
export default function CreateRandomAliasButton({
|
export default function CreateRandomAliasButton({
|
||||||
onCreated,
|
onCreated,
|
||||||
}: CreateRandomAliasButtonProps): ReactElement {
|
}: CreateRandomAliasButtonProps): ReactElement {
|
||||||
const {mutate} = useMutation<Alias, AxiosError, CreateAliasData>(
|
const {mutate, isLoading} = useMutation<Alias, AxiosError, CreateAliasData>(
|
||||||
createAlias,
|
createAlias,
|
||||||
{
|
{
|
||||||
onSuccess: onCreated,
|
onSuccess: onCreated,
|
||||||
@ -24,6 +24,7 @@ export default function CreateRandomAliasButton({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isLoading}
|
||||||
startIcon={<BsArrowClockwise />}
|
startIcon={<BsArrowClockwise />}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
mutate({
|
mutate({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {ReactElement} from "react"
|
import {ReactElement} from "react"
|
||||||
import {AxiosError} from "axios"
|
import {AxiosError} from "axios"
|
||||||
|
|
||||||
import {List} from "@mui/material"
|
import {Grid, List, Typography} from "@mui/material"
|
||||||
import {useQuery} from "@tanstack/react-query"
|
import {useQuery} from "@tanstack/react-query"
|
||||||
|
|
||||||
import {Alias} from "~/server-types"
|
import {Alias} from "~/server-types"
|
||||||
@ -18,6 +18,11 @@ export default function AliasesRoute(): ReactElement {
|
|||||||
} = useQuery<Array<Alias>, AxiosError>(["get_aliases"], getAliases)
|
} = useQuery<Array<Alias>, AxiosError>(["get_aliases"], getAliases)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Grid direction="column" container spacing={4}>
|
||||||
|
<Grid item>
|
||||||
|
<Typography variant="h6" component="h2">
|
||||||
|
Random Aliases
|
||||||
|
</Typography>
|
||||||
<List>
|
<List>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<LoadingData />
|
<LoadingData />
|
||||||
@ -26,7 +31,11 @@ export default function AliasesRoute(): ReactElement {
|
|||||||
<AliasListItem key={alias.id} alias={alias} />
|
<AliasListItem key={alias.id} alias={alias} />
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
<CreateRandomAliasButton onCreated={() => refetch()} />
|
|
||||||
</List>
|
</List>
|
||||||
|
</Grid>
|
||||||
|
<Grid item>
|
||||||
|
<CreateRandomAliasButton onCreated={() => refetch()} />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user