Skip to content

Instantly share code, notes, and snippets.

@asvae
Last active July 3, 2017 15:23
Show Gist options
  • Save asvae/9d64a1ea2feaff2070da5fd16c9761db to your computer and use it in GitHub Desktop.
Save asvae/9d64a1ea2feaff2070da5fd16c9761db to your computer and use it in GitHub Desktop.
Country store
import CountryRepository from '../classes/Api/CountryRepository.js'
import Country from "../classes/Domain/Entity/Country";
export default {
_isInitialized: false,
_countries: [],
get countries (): Array<Country> {
if (!this._isInitialized) {
this._isInitialized = true
this._loadCountries()
}
return this._countries
},
async _loadCountries () {
this._countries = await CountryRepository.getAll()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment