Skip to content

Commit 197ba2a

Browse files
dacosta444Daniel Costatenphi
authored
Relative paths for assets, playground requests and fonts (#9850)
Co-authored-by: Daniel Costa <[email protected]> Co-authored-by: Andrey Yamanov <[email protected]>
1 parent 3dcaa00 commit 197ba2a

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

packages/cubejs-playground/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class App extends Component<PropsWithChildren<RouteComponentProps>, AppState> {
6363
});
6464
});
6565

66-
const res = await fetch('/playground/context');
66+
const res = await fetch('playground/context');
6767
const context = await res.json();
6868

6969
setTelemetry(context.telemetry);
@@ -112,7 +112,7 @@ class App extends Component<PropsWithChildren<RouteComponentProps>, AppState> {
112112
<LivePreviewContextProvider
113113
disabled={!context?.livePreview}
114114
>
115-
<Root styles={ROOT_STYLES}>
115+
<Root publicUrl="." styles={ROOT_STYLES}>
116116
<GlobalStyles />
117117

118118
<Header selectedKeys={[location.pathname]} />

packages/cubejs-playground/src/components/LivePreviewContext/LivePreviewContextProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const useLivePreview = (disabled = false) => {
7070
// }, [status]);
7171

7272
const fetchStatus = () => {
73-
return fetch('/playground/live-preview/status')
73+
return fetch('playground/live-preview/status')
7474
.then((res) => res.json())
7575
.then((status) => {
7676
setStatus({
@@ -81,7 +81,7 @@ const useLivePreview = (disabled = false) => {
8181
};
8282

8383
const createTokenWithPayload = async (payload): Promise<any> => {
84-
const res = await fetch('/playground/live-preview/token', {
84+
const res = await fetch('playground/live-preview/token', {
8585
method: 'POST',
8686
headers: {
8787
'Content-Type': 'application/json',
@@ -108,7 +108,7 @@ const useLivePreview = (disabled = false) => {
108108
statusLivePreview: status,
109109
createTokenWithPayload,
110110
stopLivePreview: async (): Promise<Boolean> => {
111-
await fetch('/playground/live-preview/stop');
111+
await fetch('playground/live-preview/stop');
112112
await fetchStatus();
113113
return true;
114114
},

packages/cubejs-playground/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function onTokenPayloadChange(payload: Record<string, any>, token) {
2626
return token;
2727
}
2828

29-
const response = await fetch('/playground/token', {
29+
const response = await fetch('playground/token', {
3030
method: 'post',
3131
headers: {
3232
'Content-Type': 'application/json',

packages/cubejs-playground/src/pages/ConnectionWizard/ConnectionWizardPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function testConnection(variables: Record<string, string>) {
6363
}
6464

6565
async function saveConnection(variables: Record<string, string>) {
66-
await fetch('/playground/env', {
66+
await fetch('playground/env', {
6767
method: 'post',
6868
headers: {
6969
'Content-Type': 'application/json',
@@ -174,7 +174,7 @@ export function ConnectionWizardPage({ history }) {
174174
}
175175

176176
{
177-
const response = await fetch('/playground/driver', {
177+
const response = await fetch('playground/driver', {
178178
method: 'post',
179179
headers: {
180180
'Content-Type': 'application/json',

packages/cubejs-playground/src/pages/Index/IndexPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function IndexPage() {
1212

1313
useEffect(() => {
1414
async function loadFiles() {
15-
const res = await fetch('/playground/files');
15+
const res = await fetch('playground/files');
1616
const result = await res.json();
1717

1818
if (result.error?.includes('Model files not found')) {

packages/cubejs-playground/src/pages/Schema/SchemaPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
7878
async loadDBSchema() {
7979
this.setState({ schemaLoading: true });
8080
try {
81-
const res = await playgroundFetch('/playground/db-schema');
81+
const res = await playgroundFetch('playground/db-schema');
8282
const result = await res.json();
8383
this.setState({
8484
tablesSchema: result.tablesSchema,
@@ -91,7 +91,7 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
9191
}
9292

9393
async loadFiles() {
94-
const res = await playgroundFetch('/playground/files');
94+
const res = await playgroundFetch('playground/files');
9595
const result = await res.json();
9696
this.setState({
9797
files: result.files,
@@ -106,7 +106,7 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
106106
const options = { format };
107107

108108
playgroundAction('Generate Schema', options);
109-
const res = await playgroundFetch('/playground/generate-schema', {
109+
const res = await playgroundFetch('playground/generate-schema', {
110110
method: 'POST',
111111
headers: {
112112
'Content-Type': 'application/json',

packages/cubejs-playground/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react';
44
import environmentPlugin from 'vite-plugin-environment';
55

66
export default defineConfig(({ mode }) => ({
7+
base: './',
78
build: {
89
outDir: 'build',
910
target: 'es2018',

0 commit comments

Comments
 (0)