import Ember from 'ember';

export default Ember.Service.extend({
  store: Ember.inject.service(),

  currency () {
    return this.get('store').findRecord('setting', 'currency-symbol')
      .then(response => response.get('value'))
      .catch(err => {
        if (typeof err === 'undefined') {
          return '$';
        }
      });
  },

  currencyNames () {
    return ['AUD', 'CAD', 'CHF', 'EUR', 'GBP', 'JPY', 'NZD', 'RUB', 'USD'];
  }
});

import Ember from 'ember';

export default Ember.Service.extend({
  store: Ember.inject.service(),
  currencies: ['AUD', 'CAD', 'CHF', 'EUR', 'GBP', 'JPY', 'NZD', 'RUB', 'USD'],

  currencySymbol () {
    return this.get('store').findRecord('setting', 'st-setting')
      .then(response => response.get('currencySymbol'))
      .catch(err => {
        if (typeof err === 'undefined') {
          return '$';
        }
      });
  },

  currentCurrencyName () {
    return this.get('store').findRecord('setting', 'st-setting')
      .then(response => response.get('currencyName'))
      .catch(err => {
        if (typeof err === 'undefined') {
          return 'USD';
        }
      });
  },
  }
});

Add user-setting method that returns current currency name
feat: Add user-setting method that returns current currency name

