M
M
mirexdoors2018-03-22 20:44:27
PHP
mirexdoors, 2018-03-22 20:44:27

How to prevent session reset on fetch request?

Hello! Faced the following problem:
There is a project react + php. It is necessary to save user data when reloading the page. But with fetch requests, the session is overwritten with a new one. Tried using credentials: 'include' in query parameters - didn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Aleksandrovich, 2018-03-22
@RomReed

usually, after authorization, the server returns a token that is stored in the localStore. You can also put information about the user there. After reloading the page, you can query the localStore and if there is data, then display it and skip authorization, and if not, then require authorization from the user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question