{"action":"created","comment":{"url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/comments/72624614","id":72624614,"diff_hunk":"@@ -21,14 +23,47 @@ export function checkNested(obj: any, ...keys: string[]): boolean {\n     }, true);\n }\n \n-export function getParam(param): string | null {\n-  const queryParams = window.location.search\n-    .substring(1)\n-    .split('&');\n-  const index = queryParams.findIndex(value => value.indexOf(param) === 0);\n-  return index !== -1 && queryParams[index].includes('=') ? queryParams[index].split('=')[1] : null;\n+export function getParam(param):string | null {\n+  return queryString.parse(window.location.search)[param] || null;\n }\n \n-export const unless = (obj: any, defaultObj: any) => obj == undefined ? defaultObj : obj;\n+export const unless = (obj:any, defaultObj:any) => obj == undefined ? defaultObj : obj;\n \n-export const getPath = (obj: any, path: string) => oget(obj, path);\n+export const getPath = (obj:any, path:string) => oget(obj, path);\n+\n+export const updateLocation = (searchUrl:string, queryParam:string, query:string, refinements:Array<any>) => {\n+  const queryObj = {};\n+\n+  if (refinements.length > 0) {\n+    queryObj['refinements'] = JSON.stringify(refinements)\n+  }\n+\n+  queryObj[queryParam] = query;\n+\n+  console.log(window.location.pathname);\n+\n+  if (window.location.pathname === searchUrl) {\n+    // Better way to do this is with browser history rewrites\n+    window.location.search = `?${queryString.stringify(queryObj)}`;\n+  } else {\n+    window.location.replace(`${searchUrl}?${queryString.stringify(queryObj)}`);\n+  }\n+};\n+\n+export const parseQueryFromLocation = (queryParamName, queryConfig) => {","path":"src/utils.ts","position":64,"original_position":64,"commit_id":"068825f6bc605483bbcb6affb25e20b3fb4eb7b8","original_commit_id":"068825f6bc605483bbcb6affb25e20b3fb4eb7b8","user":{"login":"ehacke","id":4016786,"avatar_url":"https://avatars.githubusercontent.com/u/4016786?v=3","gravatar_id":"","url":"https://api.github.com/users/ehacke","html_url":"https://github.com/ehacke","followers_url":"https://api.github.com/users/ehacke/followers","following_url":"https://api.github.com/users/ehacke/following{/other_user}","gists_url":"https://api.github.com/users/ehacke/gists{/gist_id}","starred_url":"https://api.github.com/users/ehacke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehacke/subscriptions","organizations_url":"https://api.github.com/users/ehacke/orgs","repos_url":"https://api.github.com/users/ehacke/repos","events_url":"https://api.github.com/users/ehacke/events{/privacy}","received_events_url":"https://api.github.com/users/ehacke/received_events","type":"User","site_admin":false},"body":"Add typing to args","created_at":"2016-07-28T13:48:05Z","updated_at":"2016-07-28T13:48:05Z","html_url":"https://github.com/groupby/searchandiser-ui/pull/33#discussion_r72624614","pull_request_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/comments/72624614"},"html":{"href":"https://github.com/groupby/searchandiser-ui/pull/33#discussion_r72624614"},"pull_request":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33","id":79068356,"html_url":"https://github.com/groupby/searchandiser-ui/pull/33","diff_url":"https://github.com/groupby/searchandiser-ui/pull/33.diff","patch_url":"https://github.com/groupby/searchandiser-ui/pull/33.patch","issue_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/33","number":33,"state":"open","locked":false,"title":"BBD-146 Redirect on submit button click","user":{"login":"ehacke","id":4016786,"avatar_url":"https://avatars.githubusercontent.com/u/4016786?v=3","gravatar_id":"","url":"https://api.github.com/users/ehacke","html_url":"https://github.com/ehacke","followers_url":"https://api.github.com/users/ehacke/followers","following_url":"https://api.github.com/users/ehacke/following{/other_user}","gists_url":"https://api.github.com/users/ehacke/gists{/gist_id}","starred_url":"https://api.github.com/users/ehacke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehacke/subscriptions","organizations_url":"https://api.github.com/users/ehacke/orgs","repos_url":"https://api.github.com/users/ehacke/repos","events_url":"https://api.github.com/users/ehacke/events{/privacy}","received_events_url":"https://api.github.com/users/ehacke/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-27T17:53:24Z","updated_at":"2016-07-28T13:48:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb05e51058a25d943def5530ba0bda6bfc5e77d4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33/commits","review_comments_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33/comments","review_comment_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/33/comments","statuses_url":"https://api.github.com/repos/groupby/searchandiser-ui/statuses/068825f6bc605483bbcb6affb25e20b3fb4eb7b8","head":{"label":"groupby:BBD-146","ref":"BBD-146","sha":"068825f6bc605483bbcb6affb25e20b3fb4eb7b8","user":{"login":"groupby","id":2799385,"avatar_url":"https://avatars.githubusercontent.com/u/2799385?v=3","gravatar_id":"","url":"https://api.github.com/users/groupby","html_url":"https://github.com/groupby","followers_url":"https://api.github.com/users/groupby/followers","following_url":"https://api.github.com/users/groupby/following{/other_user}","gists_url":"https://api.github.com/users/groupby/gists{/gist_id}","starred_url":"https://api.github.com/users/groupby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupby/subscriptions","organizations_url":"https://api.github.com/users/groupby/orgs","repos_url":"https://api.github.com/users/groupby/repos","events_url":"https://api.github.com/users/groupby/events{/privacy}","received_events_url":"https://api.github.com/users/groupby/received_events","type":"Organization","site_admin":false},"repo":{"id":60352950,"name":"searchandiser-ui","full_name":"groupby/searchandiser-ui","owner":{"login":"groupby","id":2799385,"avatar_url":"https://avatars.githubusercontent.com/u/2799385?v=3","gravatar_id":"","url":"https://api.github.com/users/groupby","html_url":"https://github.com/groupby","followers_url":"https://api.github.com/users/groupby/followers","following_url":"https://api.github.com/users/groupby/following{/other_user}","gists_url":"https://api.github.com/users/groupby/gists{/gist_id}","starred_url":"https://api.github.com/users/groupby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupby/subscriptions","organizations_url":"https://api.github.com/users/groupby/orgs","repos_url":"https://api.github.com/users/groupby/repos","events_url":"https://api.github.com/users/groupby/events{/privacy}","received_events_url":"https://api.github.com/users/groupby/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupby/searchandiser-ui","description":"Searchandiser UI","fork":false,"url":"https://api.github.com/repos/groupby/searchandiser-ui","forks_url":"https://api.github.com/repos/groupby/searchandiser-ui/forks","keys_url":"https://api.github.com/repos/groupby/searchandiser-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupby/searchandiser-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupby/searchandiser-ui/teams","hooks_url":"https://api.github.com/repos/groupby/searchandiser-ui/hooks","issue_events_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/events{/number}","events_url":"https://api.github.com/repos/groupby/searchandiser-ui/events","assignees_url":"https://api.github.com/repos/groupby/searchandiser-ui/assignees{/user}","branches_url":"https://api.github.com/repos/groupby/searchandiser-ui/branches{/branch}","tags_url":"https://api.github.com/repos/groupby/searchandiser-ui/tags","blobs_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupby/searchandiser-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/groupby/searchandiser-ui/languages","stargazers_url":"https://api.github.com/repos/groupby/searchandiser-ui/stargazers","contributors_url":"https://api.github.com/repos/groupby/searchandiser-ui/contributors","subscribers_url":"https://api.github.com/repos/groupby/searchandiser-ui/subscribers","subscription_url":"https://api.github.com/repos/groupby/searchandiser-ui/subscription","commits_url":"https://api.github.com/repos/groupby/searchandiser-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupby/searchandiser-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupby/searchandiser-ui/contents/{+path}","compare_url":"https://api.github.com/repos/groupby/searchandiser-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupby/searchandiser-ui/merges","archive_url":"https://api.github.com/repos/groupby/searchandiser-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupby/searchandiser-ui/downloads","issues_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues{/number}","pulls_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/groupby/searchandiser-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/groupby/searchandiser-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupby/searchandiser-ui/labels{/name}","releases_url":"https://api.github.com/repos/groupby/searchandiser-ui/releases{/id}","deployments_url":"https://api.github.com/repos/groupby/searchandiser-ui/deployments","created_at":"2016-06-03T14:15:18Z","updated_at":"2016-07-04T02:43:34Z","pushed_at":"2016-07-28T13:42:28Z","git_url":"git://github.com/groupby/searchandiser-ui.git","ssh_url":"git@github.com:groupby/searchandiser-ui.git","clone_url":"https://github.com/groupby/searchandiser-ui.git","svn_url":"https://github.com/groupby/searchandiser-ui","homepage":null,"size":2505,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"groupby:master","ref":"master","sha":"4da70f75e982d379275855303deff6d974805234","user":{"login":"groupby","id":2799385,"avatar_url":"https://avatars.githubusercontent.com/u/2799385?v=3","gravatar_id":"","url":"https://api.github.com/users/groupby","html_url":"https://github.com/groupby","followers_url":"https://api.github.com/users/groupby/followers","following_url":"https://api.github.com/users/groupby/following{/other_user}","gists_url":"https://api.github.com/users/groupby/gists{/gist_id}","starred_url":"https://api.github.com/users/groupby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupby/subscriptions","organizations_url":"https://api.github.com/users/groupby/orgs","repos_url":"https://api.github.com/users/groupby/repos","events_url":"https://api.github.com/users/groupby/events{/privacy}","received_events_url":"https://api.github.com/users/groupby/received_events","type":"Organization","site_admin":false},"repo":{"id":60352950,"name":"searchandiser-ui","full_name":"groupby/searchandiser-ui","owner":{"login":"groupby","id":2799385,"avatar_url":"https://avatars.githubusercontent.com/u/2799385?v=3","gravatar_id":"","url":"https://api.github.com/users/groupby","html_url":"https://github.com/groupby","followers_url":"https://api.github.com/users/groupby/followers","following_url":"https://api.github.com/users/groupby/following{/other_user}","gists_url":"https://api.github.com/users/groupby/gists{/gist_id}","starred_url":"https://api.github.com/users/groupby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupby/subscriptions","organizations_url":"https://api.github.com/users/groupby/orgs","repos_url":"https://api.github.com/users/groupby/repos","events_url":"https://api.github.com/users/groupby/events{/privacy}","received_events_url":"https://api.github.com/users/groupby/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupby/searchandiser-ui","description":"Searchandiser UI","fork":false,"url":"https://api.github.com/repos/groupby/searchandiser-ui","forks_url":"https://api.github.com/repos/groupby/searchandiser-ui/forks","keys_url":"https://api.github.com/repos/groupby/searchandiser-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupby/searchandiser-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupby/searchandiser-ui/teams","hooks_url":"https://api.github.com/repos/groupby/searchandiser-ui/hooks","issue_events_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/events{/number}","events_url":"https://api.github.com/repos/groupby/searchandiser-ui/events","assignees_url":"https://api.github.com/repos/groupby/searchandiser-ui/assignees{/user}","branches_url":"https://api.github.com/repos/groupby/searchandiser-ui/branches{/branch}","tags_url":"https://api.github.com/repos/groupby/searchandiser-ui/tags","blobs_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupby/searchandiser-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/groupby/searchandiser-ui/languages","stargazers_url":"https://api.github.com/repos/groupby/searchandiser-ui/stargazers","contributors_url":"https://api.github.com/repos/groupby/searchandiser-ui/contributors","subscribers_url":"https://api.github.com/repos/groupby/searchandiser-ui/subscribers","subscription_url":"https://api.github.com/repos/groupby/searchandiser-ui/subscription","commits_url":"https://api.github.com/repos/groupby/searchandiser-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupby/searchandiser-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupby/searchandiser-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupby/searchandiser-ui/contents/{+path}","compare_url":"https://api.github.com/repos/groupby/searchandiser-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupby/searchandiser-ui/merges","archive_url":"https://api.github.com/repos/groupby/searchandiser-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupby/searchandiser-ui/downloads","issues_url":"https://api.github.com/repos/groupby/searchandiser-ui/issues{/number}","pulls_url":"https://api.github.com/repos/groupby/searchandiser-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/groupby/searchandiser-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/groupby/searchandiser-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupby/searchandiser-ui/labels{/name}","releases_url":"https://api.github.com/repos/groupby/searchandiser-ui/releases{/id}","deployments_url":"https://api.github.com/repos/groupby/searchandiser-ui/deployments","created_at":"2016-06-03T14:15:18Z","updated_at":"2016-07-04T02:43:34Z","pushed_at":"2016-07-28T13:42:28Z","git_url":"git://github.com/groupby/searchandiser-ui.git","ssh_url":"git@github.com:groupby/searchandiser-ui.git","clone_url":"https://github.com/groupby/searchandiser-ui.git","svn_url":"https://github.com/groupby/searchandiser-ui","homepage":null,"size":2505,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33"},"html":{"href":"https://github.com/groupby/searchandiser-ui/pull/33"},"issue":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/issues/33"},"comments":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/groupby/searchandiser-ui/statuses/068825f6bc605483bbcb6affb25e20b3fb4eb7b8"}}}}
{"actor":{"display_login":"ehacke"}}