Skip to content

Commit

Permalink
fix: handle optional API_BASE_URL in export and upload components
Browse files Browse the repository at this point in the history
  • Loading branch information
谨欣 committed Sep 10, 2024
1 parent 6c493be commit 7e48f22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/components/flow/canvas-modal/export-flow-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ExportFlowModal: React.FC<Props> = ({
a.download = values.file_name || 'flow.json';
a.click();
} else {
const linkUrl = `${process.env.API_BASE_URL}/api/v2/serve/awel/flow/export/${values.uid}?export_type=${values.export_type}&format=${values.format}`;
const linkUrl = `${process.env.API_BASE_URL ?? ''}/api/v2/serve/awel/flow/export/${values.uid}?export_type=${values.export_type}&format=${values.format}`;
window.open(linkUrl);
}
messageApi.success(t('Export_Flow_Success'));
Expand Down
2 changes: 1 addition & 1 deletion web/components/flow/node-renderer/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const renderUpload = (params: Props) => {

const props: UploadProps = {
name: 'files',
action: process.env.API_BASE_URL + data.ui.action,
action: process.env.API_BASE_URL ?? '' + data.ui.action,
headers: {
authorization: 'authorization-text',
},
Expand Down
2 changes: 1 addition & 1 deletion web/utils/ctx-axios.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const api = axios.create({
baseURL: process.env.API_BASE_URL,
baseURL: process.env.API_BASE_URL ?? '',
});

api.defaults.timeout = 10000;
Expand Down

0 comments on commit 7e48f22

Please sign in to comment.