S
S
Seva2017-08-03 13:59:25
JavaScript
Seva, 2017-08-03 13:59:25

DOMDocument and insertbefore?

Hello,
there is markup -

<p> ... </p>
<p><img src=""></p>

You need to take a picture and stick it in front of the paragraph in which it was originally. Need to make it happen
<p> ... </p>
<img src="">

I try $image->parentNode->insertBefore($image);- it turns out garbage.
What am I doing wrong? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Robur, 2019-03-11
@SkipTyler

The correctness should be checked by the server when you want something from it with this token. On the client, everything is simple - there is a token, we consider that the user is logged in, draw buttons for him and go to the server with this token - if something is wrong, the server will tell us, for example, it will return 401, in this case we delete the token on the client and send the user to /login.

S
Ska1n, 2019-03-12
@Ska1n

I have done this:
In the store I store the key verification function, which checks if there is a key (jwt), then check it for obsolescence, if the time has come, send a request to renew the key, if not, return true, if there is no key, return false .
Further, I slip this check under each route in the global router.beforeEach, if the check returns true, next() follows from the route, if false, redirect to the page with the login form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question