fix typescript types

This commit is contained in:
imperosol 2025-03-07 17:56:08 +01:00
parent 0f6cda377c
commit 04c7df8ac8
4 changed files with 8 additions and 15 deletions

View File

@ -56,7 +56,6 @@ export const paginated = async <T>(
interface Request extends TDataShape { interface Request extends TDataShape {
client?: Client; client?: Client;
url: string;
} }
interface InterceptorOptions { interface InterceptorOptions {

View File

@ -108,7 +108,7 @@ document.addEventListener("alpine:init", () => {
* Build the object containing the query parameters corresponding * Build the object containing the query parameters corresponding
* to the current filters * to the current filters
*/ */
getQueryParams(): ProductSearchProductsDetailedData { getQueryParams(): Omit<ProductSearchProductsDetailedData, "url"> {
const search = this.search.length > 0 ? this.search : null; const search = this.search.length > 0 ? this.search : null;
// If active or archived products must be filtered, put the filter in the request // If active or archived products must be filtered, put the filter in the request
// Else, don't include the filter // Else, don't include the filter

View File

@ -24,7 +24,6 @@ document.addEventListener("alpine:init", () => {
page: Number.parseInt(initialUrlParams.get("page")) || 1, page: Number.parseInt(initialUrlParams.get("page")) || 1,
pushstate: History.Push /* Used to avoid pushing a state on a back action */, pushstate: History.Push /* Used to avoid pushing a state on a back action */,
loading: false, loading: false,
config: config,
async init() { async init() {
await this.fetchPictures(); await this.fetchPictures();
@ -51,11 +50,9 @@ document.addEventListener("alpine:init", () => {
async fetchPictures() { async fetchPictures() {
this.loading = true; this.loading = true;
this.pictures = await paginated(picturesFetchPictures, { this.pictures = await paginated(picturesFetchPictures, {
query: { // biome-ignore lint/style/useNamingConvention: API is in snake_case
// biome-ignore lint/style/useNamingConvention: API is in snake_case query: { album_id: config.albumId },
album_id: config.albumId, } as PicturesFetchPicturesData);
} as PicturesFetchPicturesData["query"],
});
this.loading = false; this.loading = false;
}, },
@ -66,7 +63,6 @@ document.addEventListener("alpine:init", () => {
Alpine.data("albums", (config: SubAlbumsConfig) => ({ Alpine.data("albums", (config: SubAlbumsConfig) => ({
albums: [] as AlbumSchema[], albums: [] as AlbumSchema[],
config: config,
loading: false, loading: false,
async init() { async init() {
@ -77,7 +73,7 @@ document.addEventListener("alpine:init", () => {
this.loading = true; this.loading = true;
this.albums = await paginated(albumFetchAlbum, { this.albums = await paginated(albumFetchAlbum, {
// biome-ignore lint/style/useNamingConvention: API is snake_case // biome-ignore lint/style/useNamingConvention: API is snake_case
query: { parent_id: this.config.parentId }, query: { parent_id: config.parentId },
} as AlbumFetchAlbumData); } as AlbumFetchAlbumData);
this.loading = false; this.loading = false;
}, },

View File

@ -17,11 +17,9 @@ document.addEventListener("alpine:init", () => {
async init() { async init() {
this.pictures = await paginated(picturesFetchPictures, { this.pictures = await paginated(picturesFetchPictures, {
query: { // biome-ignore lint/style/useNamingConvention: from python api
// biome-ignore lint/style/useNamingConvention: from python api query: { users_identified: [config.userId] },
users_identified: [config.userId], } as PicturesFetchPicturesData);
} as PicturesFetchPicturesData["query"],
});
this.albums = this.pictures.reduce( this.albums = this.pictures.reduce(
(acc: Record<string, PictureSchema[]>, picture: PictureSchema) => { (acc: Record<string, PictureSchema[]>, picture: PictureSchema) => {