revert api url changes. exclude auth from API_URL
This commit is contained in:
1 parent
8473dea1ca
commit
4956380942
3 files changed
+4
-4
No files matched your search
+1
-1
@@ -160,7 +160,7 @@ if (isRelativeUrl(apiUrl)) {
|
||||
}
|
||||
} else if (apiUrl) {
|
||||
beforeFilesRewrites.push({
|
||||
source: '/api/:path((?!config(?:/|$)).*)',
|
||||
source: '/api/:path((?!auth(?:/|$)|config(?:/|$)).*)',
|
||||
destination: `${apiUrl.replace(/\/+$/, '')}/:path`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ describe('getApiUrl', () => {
|
||||
).toBe('/analytics/internal-api/websites');
|
||||
});
|
||||
|
||||
test('uses a relative API_URL for auth routes', () => {
|
||||
test('keeps app routes on the local api path', () => {
|
||||
expect(
|
||||
getApiUrl('/auth/verify', {
|
||||
apiUrl: '/internal-api',
|
||||
basePath: '/analytics',
|
||||
}),
|
||||
).toBe('/analytics/internal-api/auth/verify');
|
||||
).toBe('/analytics/api/auth/verify');
|
||||
});
|
||||
|
||||
test('keeps config routes on the local api path', () => {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ type ApiUrlOptions = {
|
||||
basePath?: string;
|
||||
};
|
||||
|
||||
const APP_ROUTE_PATTERNS: RegExp[] = [/^\/config(\/|$)/];
|
||||
const APP_ROUTE_PATTERNS: RegExp[] = [/^\/auth(\/|$)/, /^\/config(\/|$)/];
|
||||
|
||||
function trimTrailingSlash(value: string) {
|
||||
return value.replace(/\/+$/, '');
|
||||
|
||||
Reference in new issue
Block a user