moderator-toolbox-nxg-for-reddit / modules/modmatrix/components/useModLogFetch

modules/modmatrix/components/useModLogFetch

Functions

useModLogFetch()

useModLogFetch(subredditUrl, minDate, maxDate, onBatch, onComplete, onError, enabled): void

Defined in: extension/data/modules/modmatrix/components/useModLogFetch.ts:31

Fetches all mod-log entries for the given subreddit and date range, streaming results in pages of up to 500 entries and invoking callbacks as data arrives.

The fetch only runs when enabled is true; it stops and cleans up when the component unmounts or enabled becomes false.

Parameters

subredditUrl

string | null

Absolute URL of the subreddit (e.g. https://www.reddit.com/r/example/).

minDate

number | null

Earliest timestamp to include, in milliseconds, or null for no lower bound.

maxDate

number | null

Latest timestamp to include, in milliseconds, or null for no upper bound.

onBatch

(entries, hasMore) => void

Called for each page of results as it arrives.

onComplete

() => void

Called once after the last page has been processed.

onError

() => void

Called if an unrecoverable API error occurs.

enabled

boolean

Set to true to start (or restart) the fetch; false to skip.

Returns

void