-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3: Implement a second page, Restaurants List
- added lists of sample restaurants in a fake API call - added UI for the restaurants list page
- Loading branch information
1 parent
be904d7
commit b93eef8
Showing
10 changed files
with
166 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,61 @@ | ||
export function fetchRestaurants(address, time, origin) { | ||
debugger; | ||
return new Promise((resolve, reject) => | ||
setTimeout(() => | ||
/[02468]$/.test(time) ? | ||
resolve({ data: { address, time, origin, restaurants: | ||
resolve({ | ||
data: { | ||
address, | ||
time, | ||
origin, | ||
restaurants: (/[0]$/.test(time) ? | ||
[] : | ||
[ | ||
// two entries | ||
{ | ||
id: '', | ||
title: '', | ||
address: '', | ||
category: '', | ||
distance: '', | ||
deliveryTime: 0 | ||
},{ | ||
id: '', | ||
title: '', | ||
address: '', | ||
category: '', | ||
distance: '', | ||
deliveryTime: 0 | ||
}, | ||
...(/[79]$/.test(time) ? [ | ||
'id': '121721', | ||
'name': 'Nandos Banani', | ||
'address': 'Road-11, Banani, Dhaka', | ||
'delivery-fee': 75.00, | ||
avgDeliveryTime: 60 | ||
}, { | ||
'id': '6317637', | ||
'name': 'Le Petit Souffle', | ||
'address': 'Third Floor, Century City Mall, Kalayaan Avenue, Poblacion, Makati City', | ||
'delivery-fee': 75.00, | ||
avgDeliveryTime: 60 | ||
}, | ||
...(/[68]$/.test(time) ? [ | ||
// 3 more entries | ||
{ | ||
id: '', | ||
title: '', | ||
address: '', | ||
category: '', | ||
distance: '', | ||
deliveryTime: 0 | ||
},{ | ||
id: '', | ||
title: '', | ||
address: '', | ||
category: '', | ||
distance: '', | ||
deliveryTime: 0 | ||
},{ | ||
id: '', | ||
title: '', | ||
address: '', | ||
category: '', | ||
distance: '', | ||
deliveryTime: 0 | ||
'id': '6304287', | ||
'name': 'Izakaya Kikufuji', | ||
'address': 'Little Tokyo, 2277 Chino Roces Avenue, Legaspi Village, Makati City', | ||
'delivery-fee': 75.00, | ||
avgDeliveryTime: 60 | ||
}, { | ||
'id': '6300002', | ||
'name': 'Heat - Edsa Shangri-La', | ||
'address': 'Edsa Shangri-La, 1 Garden Way, Ortigas, Mandaluyong City\n', | ||
'delivery-fee': 75.00, | ||
avgDeliveryTime: 60 | ||
}, { | ||
'id': '6318506', | ||
'name': 'Ooma', | ||
'address': 'Third Floor, Mega Fashion Hall, SM Megamall, Ortigas, Mandaluyong City', | ||
'delivery-fee': 75.00, | ||
avgDeliveryTime: 60 | ||
}, | ||
] : []) | ||
] | ||
} }) : | ||
]) | ||
} | ||
}) : | ||
reject(({ | ||
message: 'Form submission error', | ||
code: 500, | ||
errors: { | ||
time: 'Wrong time', | ||
address: 'Return to sender, address unknown' | ||
} | ||
})), 5000) | ||
})), 3000) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters