-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
842da80
commit fee8e9c
Showing
3 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/routes/console/project-[project]/messaging/topics/topic-[topic]/activity/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script lang="ts"> | ||
import type { PageData } from './$types'; | ||
import { Activity } from '$lib/layout'; | ||
export let data: PageData; | ||
</script> | ||
|
||
<Activity {...data} /> |
34 changes: 34 additions & 0 deletions
34
src/routes/console/project-[project]/messaging/topics/topic-[topic]/activity/+page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Query, type Models } from '@appwrite.io/console'; | ||
import { sdk } from '$lib/stores/sdk'; | ||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load'; | ||
import { PAGE_LIMIT } from '$lib/constants'; | ||
import type { PageLoad } from './$types'; | ||
|
||
export const load: PageLoad = async ({ params, url, route }) => { | ||
const page = getPage(url); | ||
const limit = getLimit(url, route, PAGE_LIMIT); | ||
const offset = pageToOffset(page, limit); | ||
|
||
const payload = { | ||
queries: [Query.limit(limit), Query.offset(offset)] | ||
}; | ||
|
||
// TODO: remove when the API is ready with data | ||
// This allows us to mock w/ data and when search returns 0 results | ||
const logs: Models.LogList = await sdk.forProject.client.call( | ||
'GET', | ||
new URL(`${sdk.forProject.client.config.endpoint}/messaging/topics/${params.topic}/logs`), | ||
{ | ||
'X-Appwrite-Project': sdk.forProject.client.config.project, | ||
'content-type': 'application/json', | ||
'X-Appwrite-Mode': 'admin' | ||
}, | ||
payload | ||
); | ||
|
||
return { | ||
offset, | ||
limit, | ||
logs | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters