From e81e1c808ddc7d876dfb08e4a21a034398fa36f9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 7 Nov 2023 11:06:28 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(API/index.ts):=20import=20mi?= =?UTF-8?q?ssing=20StoreComponentResponse=20type=20to=20fix=20compilation?= =?UTF-8?q?=20error=20=F0=9F=94=A7=20fix(API/index.ts):=20add=20return=20t?= =?UTF-8?q?ype=20annotation=20to=20getStoreSavedComponents=20function=20fo?= =?UTF-8?q?r=20better=20type=20safety=20and=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/controllers/API/index.ts | 5 ++++- src/frontend/src/types/store/index.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index f1c3a49a1..8f732215d 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -13,6 +13,7 @@ import { } from "../../types/api/index"; import { UserInputType } from "../../types/components"; import { FlowStyleType, FlowType } from "../../types/flow"; +import { StoreComponentResponse } from "../../types/store"; import { APIClassType, BuildStatusTypeAPI, @@ -621,7 +622,9 @@ export async function getStoreComponents( } } -export async function getStoreSavedComponents() { +export async function getStoreSavedComponents(): Promise< + StoreComponentResponse | undefined +> { try { const res = await api.get( `${BASE_URL_API}store/components/?filter_by_user=true` diff --git a/src/frontend/src/types/store/index.ts b/src/frontend/src/types/store/index.ts index a5e8856f7..8ca9905d1 100644 --- a/src/frontend/src/types/store/index.ts +++ b/src/frontend/src/types/store/index.ts @@ -9,3 +9,9 @@ export type storeComponent = { liked_by_count: number; liked_by_user?: boolean; }; + +export type StoreComponentResponse = { + count: number; + authorized: boolean; + results: storeComponent[]; +};