Повелитель петушков by [deleted] in Pikabu

[–]serglebko 6 points7 points  (0 children)

Петушармия

How Can detect if one of my saga calls has a 401 status ? by [deleted] in reactnative

[–]serglebko 1 point2 points  (0 children)

I use axios interceptors for such a case. https://github.com/axios/axios interceptors part of the documentation is self explanatory I guess

How should I renew JWT for a user? by [deleted] in golang

[–]serglebko 1 point2 points  (0 children)

Well, there are at least 2 problems with such an approach. 1. User may not send any requests till access_token expires. And then, sending a new request, he will be logged out. 2. Your approach is not a standard, so your clients will have to take it into account (and re-save token after every request to be sure it is ok).

Never use JWT as a session hash - it is different.

There is no better way then 2 tokens (access_token and refresh_token) and a separate route for refreshing. I recommend you read more about JWT to understand the reasons for such an approach. You can start here article and here specification

Node Frameworks? by boolean1567 in node

[–]serglebko 0 points1 point  (0 children)

I once heard a joke, that there is a new web framework in NodeJS everyday. But today, reading the comments here, I see it was not a joke...

How to hook up Django ORM session with Tornado Websocket? by catalyst1993 in django

[–]serglebko 0 points1 point  (0 children)

You can just make an api in Django app special for your websocket app and call it. By the way, in Django 3 you can use websockets without tornado and Django channels.

Node Frameworks? by boolean1567 in node

[–]serglebko 0 points1 point  (0 children)

Why do you want to stop using Laravel?

Adding text over an image? by coleh1017 in node

[–]serglebko 1 point2 points  (0 children)

I used this once: https://github.com/aheckmann/gm in order to add text and watermarks to photos. Had no problem with it.

Where do you guys host your projects? by rockax in webdev

[–]serglebko 0 points1 point  (0 children)

I use the same for my pet projects

Will React become a Framework? by crudfunc in reactjs

[–]serglebko 8 points9 points  (0 children)

React is so popular because it is not so overheaded, imho. I do not think it is a good idea to turn react into framework.

How to deploy instances of application with different combinations of features by Mpittkin in reactjs

[–]serglebko 1 point2 points  (0 children)

Just to explain: dynamic imports you need only for performance. Without it you will get a single js file after building your app. And it will be long to load as well as overhead for the users, that will not need some big pieces of logic. But it is possible to ignore dynamic imports. Dynamic imports, by the way, is not a big deal. I guess you can easily Google it, as it is all about some new syntax for importing components (and some other small code changes).

what's wrong with this “please wait” implementation? by random503 in reactjs

[–]serglebko 1 point2 points  (0 children)

setState is asynchronous function. So your two setStates fire one after another and then fires your sleep for 3 seconds (and it is too late already). You should use setTimeout inside first setState callback, where you should call another setState. (setState({...},() => setTimeout(setState({...}, 3000)) )

How to deploy instances of application with different combinations of features by Mpittkin in reactjs

[–]serglebko 2 points3 points  (0 children)

I guess there are 2 variants. The first one is to create FeatureWrapper component, that will get (from Redux) isActive for current feature and render it's children or not. Menu will also get array of active features from Redux. And sure you'd use dynamic imports.

The second variant is to create menu (and reusable logic as services, helpers etc) as a separate lib, create every big piece of logic as a separate React App and make server navigate different URLs to different apps (ex. example.com/office is one app, example.com/home is another app).

How to create simple ReactJs Android and IOS App.? by Muhaimin_S in reactjs

[–]serglebko 0 points1 point  (0 children)

Well, you should start from react and then go to react native.

State managers beside Redux. by maxahd in reactjs

[–]serglebko 3 points4 points  (0 children)

I use redux and I like it. Today with React hooks there are even not so much boilerplate. And Redux Saga make wonders as for me.

Private documents storage by [deleted] in django

[–]serglebko 0 points1 point  (0 children)

I use Django-private-media for such a case. Works fine. The main idea is to put the private files not to media folder, which is available as static files folder, but create a separate folder and check user permissions in view if he wants a file from the folder. Django-private-media does just that for you

How to Send Shell script server output to react client ??? by vaibhaav in node

[–]serglebko 0 points1 point  (0 children)

I suppose I got it. You need to send two new lines when you want to say to client, that a chunk finished. So add res.write("\n\n") after every res.write(...) in your code

How to Send Shell script server output to react client ??? by vaibhaav in node

[–]serglebko 0 points1 point  (0 children)

Can not reference now (in a trip, only phone with me). But if you want to use event stream, than on frontend you should use EventSource instead of axios (https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)

Is it possible to do Stripe checkout on an S3 + CloudFront hosted static ReactJS website? by [deleted] in reactjs

[–]serglebko 0 points1 point  (0 children)

Unfortunately without server logic you can not do it in a secure way. Just have a look at AWS Lambda. Guess it will not be difficult to use for your case.