mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 07:01:49 +08:00
18 lines
664 B
TypeScript
18 lines
664 B
TypeScript
import { textUtil } from '@grafana/data';
|
|
import { useUrlParams } from 'app/core/navigation/hooks';
|
|
|
|
export const usePullRequestParam = () => {
|
|
const [params] = useUrlParams();
|
|
const prParam = params.get('pull_request_url');
|
|
const newPrParam = params.get('new_pull_request_url');
|
|
const repoUrl = params.get('repo_url');
|
|
const repoType = params.get('repo_type');
|
|
|
|
return {
|
|
prURL: prParam ? textUtil.sanitizeUrl(prParam) : undefined,
|
|
newPrURL: newPrParam ? textUtil.sanitizeUrl(newPrParam) : undefined,
|
|
repoURL: repoUrl ? textUtil.sanitizeUrl(repoUrl) : undefined,
|
|
repoType: repoType ? textUtil.sanitizeUrl(repoType) : undefined,
|
|
};
|
|
};
|