usage sdk

This commit is contained in:
shimon
2023-11-27 10:37:01 +02:00
parent 96cde5fa46
commit a86f0bdc21
4 changed files with 15 additions and 15 deletions
@@ -91,10 +91,10 @@
{user.emailVerification && user.phoneVerification
? 'verified'
: user.emailVerification
? 'verified email'
: user.phoneVerification
? 'verified phone'
: 'unverified'}
? 'verified email'
: user.phoneVerification
? 'verified phone'
: 'unverified'}
</Pill>
{:else}
<Pill danger>blocked</Pill>
@@ -112,18 +112,18 @@
{$user.emailVerification && $user.phoneVerification
? 'verified'
: $user.emailVerification
? 'verified email'
: $user.phoneVerification
? 'verified phone'
: 'unverified'}
? 'verified email'
: $user.phoneVerification
? 'verified phone'
: 'unverified'}
</Pill>
{:else}
<Pill success={$user.emailVerification || $user.phoneVerification}>
{$user.emailVerification
? 'verified '
: $user.phoneVerification
? 'verified '
: 'unverified'}
? 'verified '
: 'unverified'}
</Pill>
{/if}
</div>
@@ -8,8 +8,8 @@ export const load: PageLoad = async ({ params }) => {
try {
const response = await sdk.forProject.databases.getUsage(period ?? '30d');
return {
databasesTotal: response.databasesTotal as unknown as Metric[],
databases: response.databases
databasesTotal: response.databasesTotal,
databases: response.databases as unknown as Metric[]
};
} catch (e) {
throw error(e.code, e.message);
@@ -13,7 +13,7 @@
const dispatch = createEventDispatcher();
$: requests = $usage?.requestsTotal as unknown as Array<{
$: requests = $usage?.requests as unknown as Array<{
date: number;
value: number;
}>;
@@ -26,7 +26,7 @@
<div class="u-flex u-gap-16 u-main-space-between">
<div>
<div class="heading-level-4">
{formatNum(totalMetrics($usage?.requestsTotal))}
{formatNum(totalMetrics($usage?.requests))}
</div>
<div>Requests</div>
</div>
@@ -42,7 +42,7 @@
</svelte:fragment>
</DropList>
</div>
{#if totalMetrics($usage?.requestsTotal) !== 0}
{#if totalMetrics($usage?.requests) !== 0}
<div style="height: 12rem;">
<LineChart
options={{