jeudi 19 mai 2022

Fetch with Session ID in ember JS

i am a newbie in ember and servlet. Here is the code snippet of dashboard.js from the route directory.

import Route from '@ember/routing/route';

export default class DashboardRoute extends Route {

    async model()
    {
        let response = await fetch("http://localhost:8080/Servlet/getfilename");
        let data = await response.json();
        return data;
    }
}

I have maintained Session in my Servlet (i.e) When an user logged in via login Page LoginServlet will create a Session for the request and redirects the user to the Dashboard Page, where it fetches a json response from another servlet which does a session validation. Now that throws an error saying that the Session is null.Why does this happen? Is there is way to store the Session ID in ember and send it to the servlet via fetch?

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire