Skip to content

Commit

Permalink
fix: Wrap radiology api calls with token refresh wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGT96 committed Dec 10, 2024
1 parent 5aa3e45 commit 16cc21e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/state/radiology/thunk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createAsyncThunk } from "@reduxjs/toolkit";
import { wrapper } from "libraries/apiUtils/wrapper";
import { RadiologyApi } from "../../generated";
import { customConfiguration } from "../../libraries/apiUtils/configuration";

Expand All @@ -7,35 +8,31 @@ const api = new RadiologyApi(customConfiguration());
export const getPatientStudies = createAsyncThunk(
"radiology/getPatientStudies",
async (id: string, thunkApi) =>
api
.getPatientStudiesById({ id })
wrapper(() => api.getPatientStudiesById({ id }))
.toPromise()
.catch((error) => thunkApi.rejectWithValue(error.response))
);

export const getStudySeries = createAsyncThunk(
"radiology/getStudySeries",
async (id: string, thunkApi) =>
api
.getStudySeriesById({ id })
wrapper(() => api.getStudySeriesById({ id }))
.toPromise()
.catch((error) => thunkApi.rejectWithValue(error.response))
);

export const getSerieInstances = createAsyncThunk(
"radiology/getSerieInstances",
async (id: string, thunkApi) =>
api
.getSeriesInstancesById({ id })
wrapper(() => api.getSeriesInstancesById({ id }))
.toPromise()
.catch((error) => thunkApi.rejectWithValue(error.response))
);

export const getInstancePreview = createAsyncThunk(
"radiology/getInstancePreview",
async (id: string, thunkApi) =>
api
.getInstancePreview({ id })
wrapper(() => api.getInstancePreview({ id }))
.toPromise()
.catch((error) => thunkApi.rejectWithValue(error.response))
);

0 comments on commit 16cc21e

Please sign in to comment.