diff --git a/actions.ts b/actions.ts index 8fcca60..fc479a9 100644 --- a/actions.ts +++ b/actions.ts @@ -41,17 +41,24 @@ const getRandomResultFromGCI = async ( }; const lmgcitfy = async (query: string): Promise> => { - if (!query) { - return { error: true, errorMessage: "You must provide a search query." }; + try { + if (!query) { + return { error: true, errorMessage: "You must provide a search query." }; + } + + const searchParams = new URLSearchParams(); + + searchParams.append("query", query); + + const redirectURL = `https://guncadindex.com/search?${searchParams}`; + + return { error: false, payload: redirectURL }; + } catch (error) { + if (error instanceof Error) { + console.error(error.message); + } + return { error: true, errorMessage: "Something went wrong." }; } - - const searchParams = new URLSearchParams(); - - searchParams.append("query", query); - - const redirectURL = `https://guncadindex.com/search?${searchParams}`; - - return { error: false, payload: redirectURL }; }; export { getRandomResultFromGCI, lmgcitfy }; diff --git a/app/page.tsx b/app/page.tsx index 1011c97..2ad8fe9 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -112,7 +112,7 @@ export default function Home() { setTimeout(() => { buttonRef.current!.style.scale = `1`; - }, 2350); + }, 1750); setTimeout(() => { toaster.create({