set-cookie with express api
Unanswered
Ariegeois posted this in #help-forum
AriegeoisOP
hi guys, so when making a call to my external api (currently just a core setup for express (using express-sessions):
What would i need to do on the client side (within nextjs) when recieving the set-cookie header?
"use server";
import axios from "axios";
import { redirect } from "next/navigation";
export default async function handleLoginFormSubmit(
username: string,
password: string
) {
try {
const response = await axios.post(
"http://localhost:4000/login",
{
username,
password,
},
{ withCredentials: true }
);
console.log(response.headers);
} catch (error) {
console.error("Login failed", error);
}
}What would i need to do on the client side (within nextjs) when recieving the set-cookie header?
1 Reply
[please don't fetch your own api in server component](https://nextjs-faq.com/fetch-api-in-rsc)