Skip to content

Commit 676f035

Browse files
fix: Graphql questions would not display text values in history downloads #91235 (#1026)
1 parent 7cae94e commit 676f035

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/routes/download/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ router.get('/form/records/:id/history', async (req, res) => {
223223
req: req,
224224
} as any)
225225
)(),
226+
token: req.headers.authorization,
227+
...(req.headers.accesstoken && {
228+
accesstoken: req.headers.accesstoken,
229+
}),
226230
},
227231
}
228232
).getHistory();

src/server/apollo/context.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface Context {
99
user: UserWithAbility;
1010
dataSources?: ReturnType<Awaited<ReturnType<typeof dataSources>>>;
1111
token?: string;
12+
accesstoken?: string;
1213
i18next: any;
1314
timeZone: string;
1415
}
@@ -40,6 +41,9 @@ export default (server: ApolloServer<Context>) =>
4041
token: req.headers.authorization,
4142
timeZone: req.headers.usertimezone || 'UTC',
4243
locale: getICULocale(req?.headers?.language),
44+
...(req.headers.accesstoken && {
45+
accesstoken: req.headers.accesstoken,
46+
}),
4347
} as Context;
4448
}
4549
};

src/utils/form/getDisplayText.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ export const getFullChoices = async (
9191
headers: {
9292
Authorization: context.token,
9393
'Content-Type': 'application/json',
94+
...(context.accesstoken && {
95+
accesstoken: context.accesstoken,
96+
}),
9497
},
9598
data: {
9699
query: field.choicesByGraphQL.query,

0 commit comments

Comments
 (0)