chore(access-token): default expiration to never
This commit is contained in:
parent
b7d5d09f8a
commit
cc20327b8a
1 changed files with 6 additions and 6 deletions
|
|
@ -30,13 +30,17 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) {
|
||||||
const currentUser = useCurrentUser();
|
const currentUser = useCurrentUser();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
description: "",
|
description: "",
|
||||||
expiration: 30, // Default: 30 days
|
expiration: 0, // Default: never expires
|
||||||
});
|
});
|
||||||
const [createdToken, setCreatedToken] = useState<string | null>(null);
|
const [createdToken, setCreatedToken] = useState<string | null>(null);
|
||||||
const requestState = useLoading(false);
|
const requestState = useLoading(false);
|
||||||
|
|
||||||
// Expiration options in days (0 = never expires)
|
// Expiration options in days (0 = never expires)
|
||||||
const expirationOptions = [
|
const expirationOptions = [
|
||||||
|
{
|
||||||
|
label: t("setting.access-token.create-dialog.duration-never"),
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t("setting.access-token.create-dialog.duration-1m"),
|
label: t("setting.access-token.create-dialog.duration-1m"),
|
||||||
value: 30,
|
value: 30,
|
||||||
|
|
@ -45,10 +49,6 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) {
|
||||||
label: t("setting.access-token.create-dialog.duration-90d"),
|
label: t("setting.access-token.create-dialog.duration-90d"),
|
||||||
value: 90,
|
value: 90,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: t("setting.access-token.create-dialog.duration-never"),
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const setPartialState = (partialState: Partial<State>) => {
|
const setPartialState = (partialState: Partial<State>) => {
|
||||||
|
|
@ -109,7 +109,7 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
setState({
|
setState({
|
||||||
description: "",
|
description: "",
|
||||||
expiration: 30,
|
expiration: 0,
|
||||||
});
|
});
|
||||||
setCreatedToken(null);
|
setCreatedToken(null);
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue