andreypopp / andreypopp/react-async

Using session information for server-rendered pages. (Logging in.)

Đang mở
#37 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
440
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've based a project around your react-quickstart structure.

I'm developing a login system which store the currently-logged-in-user as a `logged_in` state at the top level element (above the react-router-component pages). See https://github.com/STRML/react-router-component/issues/98 for more details.

I've run into a hurdle. The top-level App class makes an AJAX call to get its `logged_in` state.

When the AJAX call is made from a browser, the express-session middleware is used to retrieve the sessions's username, and that is returned to the calling browser.

When the page is rendered server-side (because of a page refresh, for example), the AJAX call is made form the server, to the server, and so doesn't have the session details.

I suppose that what I'm looking for is a way to send the request session cookie through to the AJAX calls the server makes to itself when rendering a page server-side.

Is there a way to do this?

Or is there a better login solution which works for both client and server-rendered pages?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.