fix: create access token

This commit is contained in:
Steven
2023-09-20 21:56:56 +08:00
parent ebe54d1131
commit 7f020eade9
7 changed files with 158 additions and 137 deletions

View File

@ -70,10 +70,8 @@ const CreateAccessTokenDialog: React.FC<Props> = (props: Props) => {
try {
await userServiceClient.createUserAccessToken({
id: currentUser.id,
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,
});
if (onConfirm) {
@ -117,7 +115,7 @@ const CreateAccessTokenDialog: React.FC<Props> = (props: Props) => {
<div className="w-full flex flex-row justify-start items-center text-base">
<RadioGroup orientation="horizontal" value={state.expiration} onChange={handleRoleInputChange}>
{expirationOptions.map((option) => (
<Radio key={option.value} value={option.value} label={option.label} />
<Radio key={option.value} value={option.value} checked={state.expiration === option.value} label={option.label} />
))}
</RadioGroup>
</div>

View File

@ -112,9 +112,9 @@ const AccessTokenSection = () => {
</Button>
</td>
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-gray-900">{userAccessToken.description}</td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{String(userAccessToken.issuedAt)}</td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{userAccessToken.issuedAt?.toLocaleString()}</td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{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