Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show token expiration #100

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9,887 changes: 9,886 additions & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions resources/js/components/SanctumTokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
>
<span>{{ __("Last Used") }}</span>
</th>
<th
class="text-left px-2 whitespace-nowrap uppercase text-gray-500 text-xxs tracking-wide py-2"
>
<span>{{ __("Expires") }}</span>
</th>

<!-- View, Edit, and Delete -->
<th class="uppercase text-xxs tracking-wide px-2 py-2">
Expand Down
26 changes: 26 additions & 0 deletions resources/js/components/TokenRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
<span class="whitespace-no-wrap">{{ lastUsed }}</span>
</div>
</td>
<td
class="px-2 py-2 border-t border-gray-100 dark:border-gray-700 whitespace-nowrap dark:bg-gray-800"
>
<div
class="text-left text-left"
via-resource="users"
via-resource-id="1"
:title="expiresTooltip"
>
<span class="whitespace-no-wrap">{{ expires }}</span>
</div>
</td>
<td
class="py-2 border-t border-gray-100 dark:border-gray-700 px-2 td-fit text-right align-middle dark:bg-gray-800"
>
Expand Down Expand Up @@ -103,6 +115,20 @@ export default {
return "—";
}
},
expires() {
if (this.token.expires_at) {
return DateTime.fromISO(this.token.expires_at).toRelativeCalendar();
} else {
return "N/A";
}
},
expiresTooltip() {
if (this.token.expires_at) {
return DateTime.fromISO(this.token.expires_at).toFormat("f ZZZZ");
} else {
return "N/A";
}
},
},
methods: {
revokeToken() {
Expand Down