aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Data/AniList/wrapped.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Data/AniList/wrapped.ts')
-rw-r--r--src/lib/Data/AniList/wrapped.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Data/AniList/wrapped.ts b/src/lib/Data/AniList/wrapped.ts
index 62aff010..4ca9f772 100644
--- a/src/lib/Data/AniList/wrapped.ts
+++ b/src/lib/Data/AniList/wrapped.ts
@@ -48,7 +48,8 @@ export interface Wrapped {
const profileActivities = async (
user: AniListAuthorisation,
identity: UserIdentity,
- date = new Date()
+ date = new Date(),
+ disableLoopingActivityCounter = false
) => {
const now = date.getTime();
const get = async (page: number) =>
@@ -91,6 +92,8 @@ const profileActivities = async (
pages.push(response['data']['Page']['activities']);
while (response['data']['Page']['pageInfo']['hasNextPage']) {
+ if (disableLoopingActivityCounter) break;
+
page += 1;
response = await get(page);
@@ -121,7 +124,8 @@ export const wrapped = async (
anilistAuthorisation: AniListAuthorisation | undefined,
identity: UserIdentity,
year = new Date().getFullYear(),
- skipActivities = false
+ skipActivities = false,
+ disableLoopingActivityCounter = false
): Promise<Wrapped> => {
const headers: { [key: string]: string } = {
'Content-Type': 'application/json',
@@ -165,7 +169,8 @@ export const wrapped = async (
const { statusCount, messageCount } = await profileActivities(
anilistAuthorisation,
identity,
- new Date(year, 11, 31)
+ new Date(year, 11, 31),
+ disableLoopingActivityCounter
);
statusCountActivities = statusCount;