0๐
โ
You need to make your login function async.
methods: {
login: async function (e) {
0๐
You need to make your login function async โ
methods: {
login: async function() { ...
0๐
Hi Madhu nice seeing you here again. Ok so Jakub is correct that you should put the async behind the function. Also, Remember that .then and await do the same things , so you either use one or the other. In this case, what you want to do is this
const response = await fetch(
"http://localhost:3000/authentication/login",
{
method: "POST",
headers: {
"Content-type": "application/json"
},
body: JSON.stringify(body)
}
);
Source:stackexchange.com