diff --git a/src/app/Shared/Services/Login.service.tsx b/src/app/Shared/Services/Login.service.tsx index b629acafc7..46135fb192 100644 --- a/src/app/Shared/Services/Login.service.tsx +++ b/src/app/Shared/Services/Login.service.tsx @@ -40,7 +40,7 @@ export class LoginService { private readonly authCredentials: AuthCredentials, private readonly settings: SettingsService, ) { - this.authority = process.env.CRYOSTAT_AUTHORITY || ''; + this.authority = process.env.CRYOSTAT_AUTHORITY || '.'; this.token.next(this.getCacheItem(this.TOKEN_KEY)); this.username.next(this.getCacheItem(this.USER_KEY)); this.authMethod.next(this.getCacheItem(this.AUTH_METHOD_KEY) as AuthMethod); diff --git a/src/test/Shared/Services/Login.service.test.tsx b/src/test/Shared/Services/Login.service.test.tsx index 718b9d883e..1c55cbe4f5 100644 --- a/src/test/Shared/Services/Login.service.test.tsx +++ b/src/test/Shared/Services/Login.service.test.tsx @@ -117,7 +117,7 @@ describe('Login.service', () => { it('should make expected API calls', async () => { await firstValueFrom(svc.setLoggedOut()); expect(mockFromFetch).toHaveBeenCalledTimes(3); - expect(mockFromFetch).toHaveBeenNthCalledWith(2, `/api/v2.1/auth`, { + expect(mockFromFetch).toHaveBeenNthCalledWith(2, `./api/v2.1/auth`, { credentials: 'include', mode: 'cors', method: 'POST', @@ -126,7 +126,7 @@ describe('Login.service', () => { Authorization: `Basic dXNlcjpkNzRmZjBlZThkYTNiOTgwNmIxOGM4NzdkYmYyOWJiZGU1MGI1YmQ4ZTRkYWQ3YTNhNzI1MDAwZmViODJlOGYx`, }), }); - expect(mockFromFetch).toHaveBeenNthCalledWith(3, `/api/v2.1/logout`, { + expect(mockFromFetch).toHaveBeenNthCalledWith(3, `./api/v2.1/logout`, { credentials: 'include', mode: 'cors', method: 'POST', @@ -230,7 +230,7 @@ describe('Login.service', () => { it('should make expected API calls', async () => { await firstValueFrom(svc.setLoggedOut()); expect(mockFromFetch).toHaveBeenCalledTimes(3); - expect(mockFromFetch).toHaveBeenNthCalledWith(1, `/api/v2.1/auth`, { + expect(mockFromFetch).toHaveBeenNthCalledWith(1, `./api/v2.1/auth`, { credentials: 'include', mode: 'cors', method: 'POST', @@ -239,7 +239,7 @@ describe('Login.service', () => { Authorization: `Bearer c2hhMjU2fmhlbGxvd29ybGQ`, }), }); - expect(mockFromFetch).toHaveBeenNthCalledWith(2, `/api/v2.1/logout`, { + expect(mockFromFetch).toHaveBeenNthCalledWith(2, `./api/v2.1/logout`, { credentials: 'include', mode: 'cors', method: 'POST', @@ -248,7 +248,7 @@ describe('Login.service', () => { Authorization: `Bearer c2hhMjU2fmhlbGxvd29ybGQ`, }), }); - expect(mockFromFetch).toHaveBeenNthCalledWith(3, `/api/v2.1/auth`, { + expect(mockFromFetch).toHaveBeenNthCalledWith(3, `./api/v2.1/auth`, { credentials: 'include', mode: 'cors', method: 'POST', diff --git a/webpack.common.js b/webpack.common.js index 37d95ac2cf..b174ea7d1f 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -3,7 +3,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const BG_IMAGES_DIRNAME = 'bgimages'; -const ASSET_PATH = process.env.ASSET_PATH || '/'; module.exports = (env) => { return { @@ -154,8 +153,8 @@ module.exports = (env) => { chunkFilename: '[id].[contenthash].bundle.js', // lazy-load modules hashFunction: "xxhash64", path: path.resolve(__dirname, 'dist'), - publicPath: ASSET_PATH, - clean: true + publicPath: './', + clean: true, }, resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx'],