The page isn’t redirecting properly
Unanswered
Samir posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/1084674120182153216/3f307116ecc7d25b46a1fd5255914a4d.webp?size=256)
SamirOP
My code to fetch user's info
But somehow it just spams on tunneling site like ngrok, cloudflared
export const getUser = cache(async (): Promise<UserI> => {
const supabase = createServerComponentClient<Database>({ cookies });
// gets authenticated data
const { data } = await supabase.auth.getUser();
if (data.user !== null) {
const { data: profile, error: profileE } = await supabase
.from("users")
.select("*")
.eq("user_id", data.user.id)
.maybeSingle();
if (
profile === null ||
profileE !== null ||
Object.keys(profile).length === 0
) {
redirect("/login");
}
Object.defineProperty(profile, "email", {
value: data.user.email,
writable: false,
});
return profile as UserI;
}
redirect("/login");
});
But somehow it just spams on tunneling site like ngrok, cloudflared
1 Reply
![Avatar](https://cdn.discordapp.com/avatars/1084674120182153216/3f307116ecc7d25b46a1fd5255914a4d.webp?size=256)
SamirOP
![Image](https://cdn.discordapp.com/attachments/1158802994767331380/1158803025821966436/image.png?ex=651d92ea&is=651c416a&hm=afda5406d0b1a24ee1e3a4a788735b02dc4d9a3518cd62310b128a7b2f87c626&)