Skip to content

Commit 187eb87

Browse files
authored
fix: authenticateRequest (#998)
1 parent de23610 commit 187eb87

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/req-utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ export const getAuthorizationHeadersFromReq = (req) => {
1919
}
2020

2121
result['Authorization'] = authorization;
22-
} else if (apiKey) {
22+
}
23+
24+
if (apiKey) {
2325
result['Api-Key'] = apiKey;
24-
} else if (personalToken) {
26+
}
27+
28+
if (personalToken) {
2529
result['Personal-Token'] = personalToken;
2630
}
2731

pages/receipts/transactions/[id]/[filename].js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Receipt from '../../../../components/Receipt';
88

99
class TransactionReceipt extends React.Component {
1010
static async getInitialProps(ctx) {
11-
const isServer = Boolean(ctx);
11+
const isServer = Boolean(ctx.req);
1212
if (isServer) {
1313
const { id, pageFormat } = ctx.query;
1414
const authorizationHeaders = authenticateRequest(ctx.req);
@@ -19,7 +19,7 @@ class TransactionReceipt extends React.Component {
1919
};
2020
}
2121

22-
return { pageFormat: ctx?.query?.pageFormat };
22+
return { pageFormat: ctx.query?.pageFormat };
2323
}
2424

2525
static getReceiptFromData(transaction) {

0 commit comments

Comments
 (0)