feat(frontend): hide revoked api tokens (#307)

This commit is contained in:
Julian Tölle 2023-10-15 15:19:26 +02:00 committed by GitHub
parent 9a729ed588
commit 4cef4f75ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,10 @@ import { Spinner } from "./ui/Spinner";
export const AuthApiTokens: React.FC = () => { export const AuthApiTokens: React.FC = () => {
const { apiTokens, isLoading, createToken, revokeToken } = useApiTokens(); const { apiTokens, isLoading, createToken, revokeToken } = useApiTokens();
const sortedTokens = useMemo( const sortedTokens = useMemo(
() => apiTokens.sort((a, b) => (a.createdAt > b.createdAt ? -1 : 1)), () =>
apiTokens
.filter((token) => !token.revokedAt)
.sort((a, b) => (a.createdAt > b.createdAt ? -1 : 1)),
[apiTokens], [apiTokens],
); );
@ -22,7 +25,7 @@ export const AuthApiTokens: React.FC = () => {
<p className="mb-4"> <p className="mb-4">
You can use API Tokens to access the Listory API directly. You can You can use API Tokens to access the Listory API directly. You can
find the API docs{" "} find the API docs{" "}
<a href="/api/docs" target="_blank"> <a href="/api/docs" target="_blank" className={"underline"}>
here here
</a> </a>
. .