fix typescript types

This commit is contained in:
imperosol 2025-03-07 17:56:08 +01:00
parent 58b7566e8f
commit ed71ba09ba
4 changed files with 8 additions and 14 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

@ -51,11 +51,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 +64,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 +74,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) => {