Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changed client code to dynamically call domain in address bar #217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions app/client/src/api/config.ts

This file was deleted.

15 changes: 1 addition & 14 deletions app/client/src/api/generator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import generator from './generator';
import { TEST_PORT, TEST_HOST, TEST_PROTOCOL } from './mocks/generatorTestVariables';

// how to use local variables in jest mock to get rid of hoisting mocks to top most code block:
//stackoverflow.com/questions/44649699/service-mocked-with-jest-causes-the-module-factory-of-jest-mock-is-not-allowe
jest.mock('./config', () => {
const generatorTestVariables = require('./mocks/generatorTestVariables');

return {
host: generatorTestVariables.TEST_HOST,
protocol: generatorTestVariables.TEST_PROTOCOL,
port: generatorTestVariables.TEST_PORT,
};
});


describe('generator.ts', () => {
afterEach(() => {
jest.clearAllMocks();
Expand All @@ -27,7 +14,7 @@ describe('generator.ts', () => {
const result = generator(roomID);

expect(result).toMatch(
`${TEST_PROTOCOL}://${TEST_HOST}:${TEST_PORT}/${roomID}`
`/${roomID}`
);
});
});
Expand Down
9 changes: 1 addition & 8 deletions app/client/src/api/generator.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import config from './config';

export default (resourceName = '') => {
const { port, protocol, host } = config;

const resourcePath = resourceName;

if (!host) {
return `/localhost`;
}

return `${protocol}://${host}:${port}/${resourcePath}`;
return `/${resourcePath}`;
};
1 change: 1 addition & 0 deletions app/components/StepsOfStepper/ScanQRStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { IpcEvents } from '../../main/IpcEvents.enum';

const { port } = config;

// can the comment bellow be removed? Because the port is being defined in the config file, although it can't be changed after bundling I think
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for the maintainer ☝️

// TODO: change port to user defined port, if it is really defined
const CLIENT_VIEWER_PORT = isProduction() ? port : '3000';

Expand Down