File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,9 @@ export const ConfigureGitlabModalBody: FC<{
48
48
49
49
const checkDomainWithRegex = ( domain : string ) => {
50
50
const regex =
51
- / ^ ( h t t p s : \/ \/ ) ? [ a - z A - Z 0 - 9 ] + ( [ - . ] [ a - z A - Z 0 - 9 ] + ) * \. [ a - z A - Z ] { 2 , } ( : [ 0 - 9 ] { 1 , 5 } ) ? ( \/ .* ) ? $ / ;
51
+ / ^ ( h t t p s ? : \/ \/ ) [ a - z A - Z 0 - 9 ] + ( [ - . ] [ a - z A - Z 0 - 9 ] + ) * \. [ a - z A - Z ] { 2 , } ( : [ 0 - 9 ] { 1 , 5 } ) ? ( \/ .* ) ? $ / ;
52
52
return regex . test ( domain ) ;
53
53
} ;
54
-
55
54
const handleTokenChange = ( e : string ) => {
56
55
token . set ( e ) ;
57
56
showScopeError . set ( '' ) ;
@@ -79,7 +78,7 @@ export const ConfigureGitlabModalBody: FC<{
79
78
}
80
79
81
80
depFn ( isLoading . true ) ;
82
- await checkGitLabValidity ( token . value )
81
+ await checkGitLabValidity ( token . value , customDomain . value )
83
82
. then ( async ( res ) => {
84
83
return res ;
85
84
} )
Original file line number Diff line number Diff line change @@ -63,8 +63,12 @@ export const getMissingPATScopes = async (pat: string) => {
63
63
64
64
// Gitlab functions
65
65
66
- export const checkGitLabValidity = async ( accessToken : string ) => {
67
- const url = 'https://gitlab.com/api/v4/personal_access_tokens/self' ;
66
+ export const checkGitLabValidity = async (
67
+ accessToken : string ,
68
+ customDomain ?: string
69
+ ) => {
70
+ const baseUrl = customDomain || 'https://gitlab.com' ;
71
+ const url = `${ baseUrl } /api/v4/personal_access_tokens/self` ;
68
72
try {
69
73
const response = await axios . get ( url , {
70
74
headers : {
You can’t perform that action at this time.
0 commit comments