Override LMS static JS views for custom theme

i follow steps in the link below but when i open account settings page everything disappear, it shows white page.

https://stackoverflow.com/questions/53175008/openedx-requirejs-error-when-overriding-factory-with-aws-setting

Been having the same problem @kottab
I have to override the settings page and customize the JS file account_settings_factory.js but if you look in the console, it has something to do with RequireJS’s define module.

Hoping someone can help both of us!

@regis please can you help us :grin:

Are you getting any specific errors in the JavaScript console or when you run tutor local logs --tail=100 -f? If you are, can you post those here?

Are you serving static assets from a different domain?

Could you share a link where your issue happens? If not, could you share your modified files?

@moraleja39 this is modified files:
/root/.local/share/tutor/env/build/openedx/themes/my-theme/lms/templates/student_account

<%page expression_filter=“h”/>

<%!
import json

from django.urls import reverse
from django.conf import settings
from django.utils.translation import ugettext as _

from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
from openedx.core.djangolib.markup import HTML
from webpack_loader.templatetags.webpack_loader import render_bundle
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled_for_user
%>

<%inherit file=“/main.html” />
<%def name=“online_help_token()”><% return “learneraccountsettings” %></%def>
<%namespace name=‘static’ file=‘/static_content.html’/>

<%block name=“pagetitle”>${_(“Account Settings”)}</%block>

% if duplicate_provider:

<%include file=‘/dashboard/_dashboard_third_party_error.html’ />

% endif

<%block name="headextra"> <%static:css group='style-course'/>

<%block name=“js_extra”>
<%static:require_module module_name=“my-theme/js/student_account/views/account_settings_factory” class_name=“AccountSettingsFactory”>
var fieldsData = ${ fields | n, dump_js_escaped_json },
ordersHistoryData = ${ order_history | n, dump_js_escaped_json },

/root/.local/share/tutor/env/build/openedx/themes/my-theme/lms/static/js/student_account/views

(function(define, undefined) {
‘use strict’;
define([
‘gettext’,
‘jquery’,
‘underscore’,
‘common/js/components/views/tabbed_view’,
‘edx-ui-toolkit/js/utils/html-utils’,
‘js/student_account/views/account_section_view’,
‘text!templates/student_account/account_settings.underscore’
], function(gettext, $, _, TabbedView, HtmlUtils, AccountSectionView, accountSettingsTemplate) {
var AccountSettingsView = TabbedView.extend({

        navLink: '.account-nav-link',
        activeTab: 'aboutTabSections',
        accountSettingsTabs: [
            {
                name: 'aboutTabSections',
                id: 'about-tab',
                label: gettext('Account Information'),
                class: 'active',
                tabindex: 0,
                selected: true,
                expanded: true
            },
            {
                **name: 'accountsTabSections ***hide this section***',**
                id: 'accounts-tab',
                label: gettext('Linked Accounts'),
                tabindex: -1,
                selected: false,
                expanded: false
            },
            {
                **name: 'ordersTabSections ***hide this section***',**
                id: 'orders-tab',
                label: gettext('Order History'),
                tabindex: -1,
                selected: false,
                expanded: false
            }
        ],
        events: {
            'click .account-nav-link': 'switchTab',
            'keydown .account-nav-link': 'keydownHandler'
        },

and this is error message:

lms_1 | 2020-10-21 09:06:20,725 ERROR 10 [openedx.core.djangoapps.user_api.accounts.settings_views] settings_views.py:72 - Error fetching order history from Otto.
lms_1 | Traceback (most recent call last):
lms_1 | File “/openedx/edx-platform/openedx/core/djangoapps/user_api/accounts/settings_views.py”, line 70, in account_settings_context
lms_1 | user_orders = get_user_orders(user)
lms_1 | File “/openedx/edx-platform/openedx/core/djangoapps/user_api/accounts/settings_views.py”, line 164, in get_user_orders
lms_1 | api = ecommerce_api_client(user)
lms_1 | File “/openedx/edx-platform/openedx/core/djangoapps/commerce/utils.py”, line 41, in ecommerce_api_client
lms_1 | session=session
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/edx_rest_api_client/client.py”, line 157, in init
lms_1 | raise ValueError(‘An API url must be supplied!’)
lms_1 | ValueError: An API url must be supplied!

lms_1 | raise ValueError(‘An API url must be supplied!’)
lms_1 | ValueError: An API url must be supplied!

You should probably dig deeper into this, which seems to have something to do with your e-commerce plugin and may not be related to your code changes at all. What happens if you revert your code changes in my-theme/lms/templates/student_account and rebuild your openedx container? Do you still get the same error in lms_1?