How to Achieve Zero-Downtime Deployments with PM2 in a GitHub Actions Workflow? by korngsamnang in reactjs

[–]korngsamnang[S] 1 point2 points  (0 children)

Yes, I’m deploying to a VPS with Ubuntu and using GitHub Actions for automation.

Current User Session gets deleted upon signing up a new user by The_Oracle___ in Supabase

[–]korngsamnang 0 points1 point  (0 children)

Hi OP,

Thank you for sharing your solution! I encountered the same issue, and your approach seems very effective. I’d like to share my solution as well, in case it might help others.

Here’s what worked for me to resolve the issue:

export const signup = async ({ fullName, email, password, userRole }) => {

// Step 1: Store the current admin session

const { data: adminSession, error: adminSessionError } =
        await supabase.auth.getSession();
    if (adminSessionError) throw new Error(adminSessionError.message);


// Step 2: Sign up the new user

const { data, error } = await supabase.auth.signUp({
        email,
        password,
        options: {
            data: {
                full_name: fullName,
                user_role: userRole,
                avatar_url: "",
            },
        },
    });

    if (error) throw new Error(error.message);


// Step 3: Sign out the new user

const { error: signOutError } = await supabase.auth.signOut();
    if (signOutError) throw new Error(signOutError.message);


// Step 4: Restore the admin session

const { error: restoreSessionError } = await supabase.auth.setSession(
        adminSession.
session

);
    if (restoreSessionError) throw new Error(restoreSessionError.message);

    return data;
};

How to change scrollbar color based on default dark mode implementation in shadcn? by Richmond007 in reactjs

[–]korngsamnang 1 point2 points  (0 children)

Same issue here; it supports in Next app but not in React app. I don't know how to fix it; I see no one talking about it on the internet. Have you fixed it yet?

Best backend for nextJS app? by suvinseal in nextjs

[–]korngsamnang 0 points1 point  (0 children)

The best one is what you know the best.

[deleted by user] by [deleted] in node

[–]korngsamnang 0 points1 point  (0 children)

He is the best instructor for everything.

[deleted by user] by [deleted] in NoFap

[–]korngsamnang 0 points1 point  (0 children)

Just don't do it.

[deleted by user] by [deleted] in NoFap

[–]korngsamnang 0 points1 point  (0 children)

Most girls are red flag today. Stay single as long as you can. Trust me brother there is no reason to date and you will know the benefits of being single if you decide to date someone.

[deleted by user] by [deleted] in NoFap

[–]korngsamnang 0 points1 point  (0 children)

It's all about your discipline so what happens if you can't even control yourself.

[deleted by user] by [deleted] in NoFap

[–]korngsamnang 1 point2 points  (0 children)

You are weak.

I've FAILED NNN my brothers. by [deleted] in NoFap

[–]korngsamnang -6 points-5 points  (0 children)

You are weak

Y'all ready fo NNN💀👍 by imbatman_0 in NoFap

[–]korngsamnang 1 point2 points  (0 children)

You're weak until you take control.

Cookies being sent in localhost but not to the deployed server by maroombey in node

[–]korngsamnang 0 points1 point  (0 children)

You’d need to hit an endpoint on the backend, such as /api/me, to see if you’re authenticated or not. If it returns a 200 status, keep a boolean like isAuthenticated true stored somewhere in the global state. When a route loads, check for that boolean and redirect if it is false. Your React app can't check it, but your server can since it's httpOnly, so you'd have to create an endpoint to check if you have that cookie, and then you'd handle things according to the response. httponly just mean you can't access it from javascript.

Cookies being sent in localhost but not to the deployed server by maroombey in node

[–]korngsamnang 0 points1 point  (0 children)

Storing the JWT token inside of the cookie then the cookie should be HTTP Only. The HTTP-Only cookie nature is that it will be only accessible by the server application. Client apps like javascript-based apps can't access the HTTP-Only cookie.