Skip to content

Commit

Permalink
Merge pull request #12233 from storybookjs/fix/12162-correct-baseUrl-…
Browse files Browse the repository at this point in the history
…copy-eject

UI: Fix eject and copy URLs for composition
  • Loading branch information
shilman committed Aug 26, 2020
2 parents 7506c1e + b7f082c commit 4fcf339
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/ui/src/components/preview/tools/copy.tsx
@@ -1,3 +1,4 @@
import { PREVIEW_URL } from 'global';
import React from 'react';
import copy from 'copy-to-clipboard';
import { IconButton, Icons } from '@storybook/components';
Expand All @@ -11,9 +12,7 @@ const copyMapper = ({ state }: Combo) => {

return {
refId,
baseUrl: ref
? `${ref.url}/iframe.html`
: `${state.location.origin + state.location.pathname}iframe.html`,
baseUrl: ref ? `${ref.url}/iframe.html` : (PREVIEW_URL as string) || 'iframe.html',
storyId,
queryParams: state.customQueryParams,
};
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/src/components/preview/tools/eject.tsx
@@ -1,3 +1,4 @@
import { PREVIEW_URL } from 'global';
import React from 'react';
import { IconButton, Icons } from '@storybook/components';
import { Consumer, Combo } from '@storybook/api';
Expand All @@ -10,9 +11,7 @@ const ejectMapper = ({ state }: Combo) => {

return {
refId,
baseUrl: ref
? `${ref.url}/iframe.html`
: `${state.location.origin + state.location.pathname}iframe.html`,
baseUrl: ref ? `${ref.url}/iframe.html` : (PREVIEW_URL as string) || 'iframe.html',
storyId,
queryParams: state.customQueryParams,
};
Expand Down

0 comments on commit 4fcf339

Please sign in to comment.