Skip to content

Commit

Permalink
fix: pr comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhy-Deriv committed Aug 6, 2024
1 parent 8fed1d0 commit 2bb3dc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 10 additions & 13 deletions src/javascript/app/common/data_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import {
triggerTradeChange,
} from '../hooks/events';

const changeTypeMap = {
trade : 'tradeChange',
purchase: 'purchaseChange',
contract: 'contractChange',
};

class DataManager {
constructor() {
this.data = {
Expand All @@ -15,12 +21,7 @@ class DataManager {
};
}

set(data, data_type, optional) {
const changeTypeMap = {
trade : 'tradeChange',
purchase: 'purchaseChange',
contract: 'contractChange',
};
set(data, data_type, optional_trigger) {
if (typeof data === 'object') {
const oldValues = {};
const newValues = {};
Expand All @@ -36,9 +37,9 @@ class DataManager {
window.dispatchEvent(new CustomEvent(changeTypeMap[data_type], {
detail: { oldValues, newValues },
}));
if (optional === 'barrier') {
if (optional_trigger === 'barrier') {
triggerBarrierChange();
} else if (optional === 'time') {
} else if (optional_trigger === 'time') {
triggerTimeChange();
} else {
switch (data_type) {
Expand Down Expand Up @@ -73,11 +74,7 @@ class DataManager {
clear(data_type) {
const oldValues = { ...this.data[data_type] };
this.data[data_type] = {};
const changeTypeMap = {
trade : 'tradeChange',
purchase: 'purchaseChange',
contract: 'contractChange',
};

window.dispatchEvent(new CustomEvent(changeTypeMap[data_type], {
detail: { oldValues, newValues: {} },
}));
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/app/pages/trade/not-available.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import { Text, Button } from '@deriv-com/quill-ui';
import { getElementById } from '../../../_common/common_functions';
import { localize } from '../../../_common/localize.js';
import dataManager from '../../common/contract_manager.js';
import dataManager from '../../common/data_manager.js';

const NotAvailable = ({ title, body }) => (
<div className='not-available-container'>
Expand Down

0 comments on commit 2bb3dc9

Please sign in to comment.