
export function parseQueryString(queryStr) {
  if (!queryStr) {
    return;
  }

  const params = queryStr.split('&').reduce((acc, str) => {
    if (!str) return acc;

    const kv = str.split('=')
    if (kv.length !== 2) return acc;

    const key = decodeURIComponent(kv[0])
    const val = decodeURIComponent(kv[1])

    return {
      ...acc,
      [key]: val,
    }
  }, {});
  return params;
}
