Skip to content

Commit

Permalink
fix: make job api provider use dm job api url from vite
Browse files Browse the repository at this point in the history
  • Loading branch information
collinlokken committed Oct 31, 2023
1 parent b4f71ad commit 2d627e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/dm-core/src/context/DMJobContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const DMJobProvider = (props: {
dmJobPath?: string
}) => {
const { token } = useContext(AuthContext)
if (!props.dmJobPath)
throw new Error('DMJobProvider is missing a job api url')
const dmJobApi = new DmJobAPI(token, props.dmJobPath)
return (
<DMJobContext.Provider value={dmJobApi}>
Expand Down
6 changes: 2 additions & 4 deletions packages/dm-core/src/services/api/DmJobAPI.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Configuration, DMJobsApi } from './configs/gen-job'

const DM_JOB_URL = process.env.REACT_APP_DM_JOB_URL ?? '/api/dmt'

export class DmJobAPI extends DMJobsApi {
constructor(token: string, baseUrl?: string) {
constructor(token: string, baseUrl: string) {
const DMTConfiguration = new Configuration({
accessToken: token,
basePath: baseUrl ?? DM_JOB_URL,
basePath: baseUrl,
})
super(DMTConfiguration)
}
Expand Down

0 comments on commit 2d627e8

Please sign in to comment.