XENOX
XENOX
TTCTheo's Typesafe Cult
Created by Aditya Kirad on 12/21/2023 in #questions
need help with customizing error page if auth is failed
umm tbh not sure then
12 replies
TTCTheo's Typesafe Cult
Created by Aditya Kirad on 12/21/2023 in #questions
need help with customizing error page if auth is failed
was there a error thrown by next auth?
12 replies
TTCTheo's Typesafe Cult
Created by Aditya Kirad on 12/21/2023 in #questions
need help with customizing error page if auth is failed
12 replies
TTCTheo's Typesafe Cult
Created by Aditya Kirad on 12/21/2023 in #questions
need help with customizing error page if auth is failed
Hey I think you can set it in authoOptions as pages: { signIn: "/login", error:<path to page> //newUser: "/onboarding", },
12 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
Thnx a lot for the help, will give it a shot
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
and set timeout just shows the message, never cancel the req...
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
so a set timeout on client side and nothing on server side?
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
yup I wanted to do both, so a message in like 10sec and then cancel if it takes 20 sec
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
sry never done this stuff 😅 this is kinda my first prod level project
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
ahhh haha true
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
y?
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
from client
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
yea
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
I was trying to use AbortController, but had no idea how to use with server action since it's like a function.
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
is this better?
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
const handleButtonClick = async () => {
const controller = new AbortController();
setIsLoading(true);

const response = await generateBulletList(userMessage || "");
if (response.code === "error") {
toast({
title: response.message,
});
setIsLoading(false);
return;
}
const cleanedString = response.message.replace(/ *- */g, "");
setMessage(cleanedString);

await updateUserAICalls();

setIsLoading(false);
};

<Button
onClick={handleButtonClick}
>
{isLoading ? <LoadingSpinner /> : <Sparkles className="w-4 h-4" />}
</Button>
const handleButtonClick = async () => {
const controller = new AbortController();
setIsLoading(true);

const response = await generateBulletList(userMessage || "");
if (response.code === "error") {
toast({
title: response.message,
});
setIsLoading(false);
return;
}
const cleanedString = response.message.replace(/ *- */g, "");
setMessage(cleanedString);

await updateUserAICalls();

setIsLoading(false);
};

<Button
onClick={handleButtonClick}
>
{isLoading ? <LoadingSpinner /> : <Sparkles className="w-4 h-4" />}
</Button>
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
Yea was trying to do that, sry I don't know the key or shortcut 🥲
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
how do you timeout if the quest is not done in like 10 seconds? const handleButtonClick = async () =>{ const response = await generateBulletList(userMessage || ""); } <Button onClick={handleButtonClick} > button </Button>
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
adding code ...
35 replies
TTCTheo's Typesafe Cult
Created by XENOX on 12/19/2023 in #questions
How do you timeout a server action?
So I know with fetch you can add a timout for api request to fetch data so if the data is not fetched during that time, it will throw an error and you can handle that and show to the user that request took too long Now how do you achieve the same with server actions? It's not an api path, so can't use fetch (I think)
35 replies