Skip to content

Commit

Permalink
use relative authority
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Dec 6, 2023
1 parent 23a2ec9 commit 582adca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/app/Shared/Services/Login.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/test/Shared/Services/Login.service.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit 582adca

Please sign in to comment.