mirror of
https://github.com/Raghu-Ch/ES6-Handson.git
synced 2026-02-10 12:43:01 -05:00
Understanding promises
This commit is contained in:
20
js/rate-service-mock.js
Normal file
20
js/rate-service-mock.js
Normal file
@@ -0,0 +1,20 @@
|
||||
let rates = [
|
||||
{
|
||||
"name": "30 years fixed",
|
||||
"rate": "13",
|
||||
"years": "30"
|
||||
},
|
||||
{
|
||||
"name": "20 years fixed",
|
||||
"rate": "2.8",
|
||||
"years": "20"
|
||||
}
|
||||
];
|
||||
|
||||
export let findAll = () => new Promise((resolve, reject) => {
|
||||
if (rates) {
|
||||
resolve(rates);
|
||||
} else {
|
||||
reject("No rates");
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user