Skip to content

Commit

Permalink
fix: URL Pathing to enable OSS to function a bit simpler with a bette…
Browse files Browse the repository at this point in the history
…r fallback

based on Shafqat's feedback
  • Loading branch information
grmartin committed Mar 18, 2024
1 parent b871217 commit 921d59f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ LANGUAGE_PREFERENCE_COOKIE_NAME=openedx-language-preference
SITE_NAME=localhost
MARKETING_SITE_BASE_URL=http://localhost:18000
SUPPORT_URL=http://localhost:18000/support
ORDER_HISTORY_URL=http://localhost:18130/api/v2/orders/
RECEIPT_URL=http://localhost:18130/api/v2/checkout/receipt/
ORDER_HISTORY_URL=''
RECEIPT_URL=''
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
Expand Down
4 changes: 2 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ LANGUAGE_PREFERENCE_COOKIE_NAME=openedx-language-preference
SITE_NAME=localhost
MARKETING_SITE_BASE_URL=http://localhost:18000
SUPPORT_URL=http://localhost:18000/support
ORDER_HISTORY_URL=http://localhost:18130/api/v2/orders/
RECEIPT_URL=http://localhost:18130/api/v2/checkout/receipt/
ORDER_HISTORY_URL=''
RECEIPT_URL=''
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
Expand Down
11 changes: 7 additions & 4 deletions src/order-history/service.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { getAuthenticatedHttpClient, getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { getConfig } from '@edx/frontend-platform';

const { ORDER_HISTORY_URL, RECEIPT_URL } = getConfig();
const { ORDER_HISTORY_URL, RECEIPT_URL, ECOMMERCE_BASE_URL } = getConfig();

const ECOMMERCE_API_BASE_URL = `${ORDER_HISTORY_URL}`;
const ECOMMERCE_RECEIPT_BASE_URL = `${RECEIPT_URL}`;
const ECOMMERCE_API_BASE_URL = `${ECOMMERCE_BASE_URL}/api/v2`;
const ECOMMERCE_RECEIPT_BASE_URL = RECEIPT_URL
? `${RECEIPT_URL}` : `${ECOMMERCE_BASE_URL}/checkout/receipt/`;
const ECOMMERCE_ORDERS_URL = ORDER_HISTORY_URL
? `${ORDER_HISTORY_URL}` : `${ECOMMERCE_API_BASE_URL}/orders/`;

// eslint-disable-next-line import/prefer-default-export
export async function getOrders(page = 1, pageSize = 20) {
const httpClient = getAuthenticatedHttpClient();
const { username } = getAuthenticatedUser();

const { data } = await httpClient.get(`${ECOMMERCE_API_BASE_URL}`, {
const { data } = await httpClient.get(`${ECOMMERCE_ORDERS_URL}`, {

Check warning on line 17 in src/order-history/service.js

View check run for this annotation

Codecov / codecov/patch

src/order-history/service.js#L17

Added line #L17 was not covered by tests
params: {
username,
page,
Expand Down

0 comments on commit 921d59f

Please sign in to comment.