2019-12-30 09:27:49 -05:00
|
|
|
<script>
|
|
|
|
|
import { onMount } from 'svelte'
|
|
|
|
|
import PaginatedList from './PaginatedList'
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import moment from 'moment'
|
|
|
|
|
|
|
|
|
|
export let account_id;
|
|
|
|
|
|
|
|
|
|
async function fetch(page) {
|
|
|
|
|
try {
|
|
|
|
|
const resp = await axios.get("/api/user/" + account_id + "/logins?page="+page);
|
|
|
|
|
return [resp.data.logins, resp.data.page];
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<PaginatedList {fetch} let:data={logins} let:pagination={pagination}>
|
2019-12-30 13:20:50 -05:00
|
|
|
<p slot="header">
|
2019-12-31 09:46:34 -05:00
|
|
|
{#if !pagination.item_count}
|
|
|
|
|
No logins yet.
|
2019-12-30 13:20:50 -05:00
|
|
|
{/if}
|
|
|
|
|
</p>
|
2019-12-30 09:27:49 -05:00
|
|
|
<table slot="body" class="table table-dark table-responsive">
|
|
|
|
|
<thead>
|
2019-12-30 13:20:50 -05:00
|
|
|
<td>From</td>
|
|
|
|
|
<td>Login Date</td>
|
2019-12-30 09:27:49 -05:00
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
|
{#each logins as login, i}
|
|
|
|
|
<tr>
|
2019-12-30 13:20:50 -05:00
|
|
|
<td>
|
2024-03-24 22:31:04 -04:00
|
|
|
<code>{login.ipAddress.ip}</code>
|
2019-12-30 13:20:50 -05:00
|
|
|
</td>
|
|
|
|
|
<td>{moment(login.login_time).format('MMMM Do YYYY, h:mm:ss a')} ({moment(login.login_time).fromNow()})</td>
|
2019-12-30 09:27:49 -05:00
|
|
|
</tr>
|
|
|
|
|
{/each}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</PaginatedList>
|