loading...

re: More secure `fetch`, but not overdone like Axios? VIEW POST

FULL DISCUSSION
 

URL building? Here's a helper I wrote, are you looking for this?

function fmtQueryParam(entry) {                                                                                          
        const k = entry[0];                                                                                              
        const v = entry[1];                                                                                              
        if (v instanceof Array)
                return v.map(i => encodeURIComponent(k) + '=' + encodeURIComponent(i)).join('&');                        
        return encodeURIComponent(k) + '=' + encodeURIComponent(v);                                                      
}

I use it with Object.entries(query).map(fmtQueryParam).join('&').

Edit: ok the whitespace got messed up in pasting cause I copied it from Nano. w/e

code of conduct - report abuse