Skip to content

Commit

Permalink
fixing feedback from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
wrt95 committed Dec 19, 2023
1 parent 8e7d37c commit 84d2309
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ export const appPreviewButtonActions = (
instanceId: string,
): AltinnButtonActionItem[] => {
const packagesRouter = new PackagesRouter({ org, app });
const subUrl = `?layout=${window.localStorage.getItem(instanceId)}`;
const queryParams = `?layout=${window.localStorage.getItem(instanceId)}`;

const action: AltinnButtonActionItem[] = [
{
title: 'top_menu.preview_back_to_editing',
menuKey: TopBarMenu.Preview,
buttonVariant: 'secondary',
headerButtonsClasses: classes.backToEditorBtn,
handleClick: () => packagesRouter.navigateToPackage('editorUiEditor', subUrl),
handleClick: () => packagesRouter.navigateToPackage('editorUiEditor', queryParams),

Check warning on line 113 in frontend/app-preview/src/components/AppBarConfig/AppPreviewBarConfig.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/app-preview/src/components/AppBarConfig/AppPreviewBarConfig.tsx#L113

Added line #L113 was not covered by tests
},
];
return action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const mockApp: string = 'app';
describe('PackagesRouter', () => {
describe('constructor', () => {
it('should default to empty strings if app and org are not provided', () => {
const routerWithoutParams = new PackagesRouter({});
const routerWithoutParams = new PackagesRouter();
expect(routerWithoutParams['app']).toEqual('');
expect(routerWithoutParams['org']).toEqual('');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export class PackagesRouter {
private app: string;
private org: string;

constructor(private paramsOptions: ParamsOptions) {
this.app = this.paramsOptions.app ?? '';
this.org = this.paramsOptions.org ?? '';
constructor(private paramsOptions?: ParamsOptions) {
this.app = this.paramsOptions?.app ?? '';
this.org = this.paramsOptions?.org ?? '';
}

public navigateToPackage(packageRoute: PackagesRoute, queryParams?: string): void {
Expand Down

0 comments on commit 84d2309

Please sign in to comment.