chore: update access token generator

This commit is contained in:
Steven
2023-09-20 20:48:34 +08:00
parent ae1e22931f
commit 5cec1a71da
9 changed files with 136 additions and 122 deletions

View File

@ -70,10 +70,8 @@ const CreateAccessTokenDialog: React.FC<Props> = (props: Props) => {
try {
await userServiceClient.createUserAccessToken({
username: currentUser.username,
userAccessToken: {
description: state.description,
expiresAt: new Date(Date.now() + state.expiration * 1000),
},
description: state.description,
expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined,
});
onConfirm();

View File

@ -119,10 +119,10 @@ const AccessTokenSection = () => {
{userAccessToken.description}
</td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500 dark:text-gray-400">
{String(userAccessToken.issuedAt)}
{userAccessToken.issuedAt?.toLocaleString()}
</td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500 dark:text-gray-400">
{String(userAccessToken.expiresAt ?? "Never")}
{userAccessToken.expiresAt?.toLocaleString() ?? "Never"}
</td>
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm">
<IconButton