Files
Tom MoorandClaude Fable 5.1 6a34835260 refactor: DRY up app stores with a shared page fetch helper and IndexedStore (#13633)
* refactor: DRY up app stores with fetchPaginated helper and IndexedStore

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor: Resolve related models by store responseKey instead of a key map

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 05:10:15 -04:00

17 lines
532 B
TypeScript

import Star from "~/models/Star";
import type { PaginationParams } from "~/types";
import IndexedStore from "./base/IndexedStore";
import type RootStore from "./RootStore";
import type { PaginatedResponse } from "./base/Store";
export default class StarsStore extends IndexedStore<Star> {
constructor(rootStore: RootStore) {
super(rootStore, Star);
}
fetchPage = async (
params?: PaginationParams
): Promise<PaginatedResponse<Star>> =>
this.fetchPaginated("/stars.list", params, [this.rootStore.documents]);
}