mirror of
				https://github.com/elyby/accounts-frontend.git
				synced 2025-05-31 14:11:58 +05:30 
			
		
		
		
	Fix E2E tests, related to the OAuth flow
This commit is contained in:
		@@ -391,7 +391,7 @@ export function oAuthComplete(params: { accept?: boolean } = {}) {
 | 
			
		||||
                } else if (resp.redirectUri.startsWith('static_page')) {
 | 
			
		||||
                    const displayCode = resp.redirectUri.includes('static_page_with_code');
 | 
			
		||||
 | 
			
		||||
                    const [, code] = resp.redirectUri.match(/code=(.+)&/) || [];
 | 
			
		||||
                    const [, code] = resp.redirectUri.match(/code=([^&]+)/) || [];
 | 
			
		||||
                    [, resp.redirectUri] = resp.redirectUri.match(/^(.+)\?/) || [];
 | 
			
		||||
 | 
			
		||||
                    dispatch(
 | 
			
		||||
 
 | 
			
		||||
@@ -69,16 +69,17 @@ const api = {
 | 
			
		||||
        success: boolean;
 | 
			
		||||
        redirectUri?: string;
 | 
			
		||||
    }> {
 | 
			
		||||
        const query = request.buildQuery(oauthData);
 | 
			
		||||
        const data: Record<string, any> = {};
 | 
			
		||||
 | 
			
		||||
        if (typeof params.accept !== 'undefined') {
 | 
			
		||||
            data.accept = params.accept;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return request
 | 
			
		||||
            .post<{
 | 
			
		||||
                success: boolean;
 | 
			
		||||
                redirectUri: string;
 | 
			
		||||
            }>(
 | 
			
		||||
                `/api/oauth2/v1/complete?${query}`,
 | 
			
		||||
                typeof params.accept === 'undefined' ? {} : { accept: params.accept },
 | 
			
		||||
            )
 | 
			
		||||
            }>(`/api/oauth2/v1/complete?${request.buildQuery(oauthData)}`, data)
 | 
			
		||||
            .catch((resp = {}) => {
 | 
			
		||||
                if (resp.statusCode === 401 && resp.error === 'access_denied') {
 | 
			
		||||
                    // user declined permissions
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user