fix(storeContext.tsx): fix setLoadingApiKey not being called in catch block to stop loading state
fix(API/index.ts): fix BASE_URL_API missing slash causing incorrect API endpoint URL fix(StorePage/index.tsx): add catch block to handle error when fetching store tags and log error message
This commit is contained in:
parent
0d8b6a3881
commit
d9aeb6b79c
3 changed files with 12 additions and 6 deletions
|
|
@ -47,6 +47,7 @@ export function StoreProvider({ children }) {
|
||||||
setValidApiKey(res?.is_valid ?? false);
|
setValidApiKey(res?.is_valid ?? false);
|
||||||
setLoadingApiKey(false);
|
setLoadingApiKey(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
setLoadingApiKey(false);
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,7 @@ export async function searchComponent(
|
||||||
|
|
||||||
export async function checkHasApiKey() {
|
export async function checkHasApiKey() {
|
||||||
try {
|
try {
|
||||||
const res = await api.get(`${BASE_URL_API}/store/check/api_key`);
|
const res = await api.get(`${BASE_URL_API}store/check/api_key`);
|
||||||
if (res?.status === 200) {
|
if (res?.status === 200) {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function StorePage(): JSX.Element {
|
||||||
"You don't have an API Key. Please add one to use the Langflow Store.",
|
"You don't have an API Key. Please add one to use the Langflow Store.",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
setLoading(false)
|
setLoading(false);
|
||||||
} else if (!validApiKey) {
|
} else if (!validApiKey) {
|
||||||
setErrorData({
|
setErrorData({
|
||||||
title: "API Key Error",
|
title: "API Key Error",
|
||||||
|
|
@ -87,9 +87,14 @@ export default function StorePage(): JSX.Element {
|
||||||
|
|
||||||
function handleGetTags() {
|
function handleGetTags() {
|
||||||
setLoadingTags(true);
|
setLoadingTags(true);
|
||||||
getStoreTags().then((res) => {
|
getStoreTags()
|
||||||
|
.then((res) => {
|
||||||
setTags(res);
|
setTags(res);
|
||||||
setLoadingTags(false);
|
setLoadingTags(false);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
setLoadingTags(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue