Skip to content

Commit

Permalink
feat: show token expiration
Browse files Browse the repository at this point in the history
- Added missing token expiration to token table

partly related to #84
  • Loading branch information
JeffBeltran committed Mar 7, 2024
1 parent 1cf8891 commit 8227e15
Show file tree
Hide file tree
Showing 3 changed files with 9,917 additions and 1 deletion.
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
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
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

0 comments on commit 8227e15

Please sign in to comment.