auth: getting viewer_id and access_token

This commit is contained in:
muerwre 2018-12-10 12:38:59 +07:00
parent e8a2e04562
commit 678f2b17a4
3 changed files with 17 additions and 3 deletions

View file

@ -8,5 +8,4 @@ export const toHours = (info) => {
return `${hrs}:${lmin}`;
};
export const toTranslit = string => ru.reduce((text, el, i) => (text.replace(new RegExp(ru[i], 'g'), en[i])), (String(string) || ''));

View file

@ -13,3 +13,16 @@ export const getUrlData = (url = getPath()) => {
path, mode, host, hash
};
};
// Parses query string
export const parseQuery = (queryString: string) => {
let params = {};
const queries = decodeURIComponent(queryString)
.substring(queryString.substr(0, 1) === '?' ? 1 : 0)
.split('&');
for (let i = 0, l = queries.length; i < l; i += 1) {
const temp = queries[i].split('=');
params = { ...params, [temp[0]]: temp[1] };
}
return params;
};