Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/SurahInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SurahInfo = ({ chapter, isShowingSurahInfo, onClose }) => {
<dd className="text-uppercase">{chapter.pages.join('-')}</dd>
</dl>
</div>
<div className={`${style.info} times-new col-md-8`}>
<div className={`${style.info} ${chapter.info.languageName} times-new col-md-8`}>
<div dangerouslySetInnerHTML={{ __html: chapter.info.text }} />
<div>
<p>
Expand Down
16 changes: 11 additions & 5 deletions src/helpers/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import config from 'config';

const methods = ['get', 'post', 'put', 'patch', 'del'];

function contentLanguage() {
return cookie.load('currentLocale') || config.defaultLocale;
}

function formatUrl(path) {
const adjustedPath = path[0] !== '/' ? `/${path}` : path;

Expand All @@ -32,11 +36,13 @@ export default class {
new Promise((resolve, reject) => {
const request = superagent[method](formatUrl(path));

if (params) {
request.query(qs.stringify(decamelizeKeys(params), {
arrayFormat: arrayFormat || 'brackets'
}));
}
params = params || {}; // eslint-disable-line no-param-reassign

params.language = contentLanguage(); // eslint-disable-line no-param-reassign

request.query(qs.stringify(decamelizeKeys(params), {
arrayFormat: arrayFormat || 'brackets'
}));

if (cookie.load('auth')) {
const headers = cookie.load('auth');
Expand Down