mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
* feat(studio): Add expiration date and last used to personal access tokens * Nit polish * ref: Mark expired tokens as such * chore: run prettier * Clean up * Nit --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: kemal <hello@kemal.earth>
32 lines
690 B
TypeScript
32 lines
690 B
TypeScript
import dayjs from 'dayjs'
|
|
|
|
export const NON_EXPIRING_TOKEN_VALUE = 'never'
|
|
export const CUSTOM_EXPIRY_VALUE = 'custom'
|
|
|
|
export const ExpiresAtOptions: Record<string, { value: string; label: string }> = {
|
|
hour: {
|
|
value: dayjs().add(1, 'hour').toISOString(),
|
|
label: '1 hour',
|
|
},
|
|
day: {
|
|
value: dayjs().add(1, 'days').toISOString(),
|
|
label: '1 day',
|
|
},
|
|
week: {
|
|
value: dayjs().add(7, 'days').toISOString(),
|
|
label: '7 days',
|
|
},
|
|
month: {
|
|
value: dayjs().add(30, 'days').toISOString(),
|
|
label: '30 days',
|
|
},
|
|
never: {
|
|
value: NON_EXPIRING_TOKEN_VALUE,
|
|
label: 'Never',
|
|
},
|
|
custom: {
|
|
value: CUSTOM_EXPIRY_VALUE,
|
|
label: 'Custom',
|
|
},
|
|
}
|