devcer / CapShun

Mozilla Public License 2.0
2 stars 10 forks source link

Move static data to external json files #10

Open devcer opened 4 years ago

devcer commented 4 years ago

Currently static data like captions, moods, tags. etc. are either in .ts files or inline code.

This will enable us to directly connect with REST APIs in the later stages.

bmusuko commented 4 years ago

Hi @devcer, can I take this issue? Here is some question for this issue, what data should be get from the external JSON file, and what data should be get from HTTP fetch? Do you have a preferable API to get the data? or i free to choose what API that will be used. Thanks!

devcer commented 4 years ago

@bmusuko https://github.com/devcer/CapShun/blob/master/src/constants/MockData.ts https://github.com/devcer/CapShun/blob/master/src/screens/HomeScreen.tsx#L10 to name a few. I would like to move them to external JSON files(probably in the src/assets/data folder(create data folder if it doesn't exist). Am I clear?

bmusuko commented 4 years ago

yeah pretty clear, can you assign it to me? @devcer

bmusuko commented 4 years ago

turns out you can't fetch() json file locally with expo https://github.com/expo/expo/issues/9098#issuecomment-654273498. I already refactor it to external json file. Is it okay to just use normal import json? @devcer

devcer commented 4 years ago

@bmusuko I see we could use fetch. Not sure though for local files. -> https://docs.expo.io/versions/v36.0.0/react-native/network/ Let me try out for one JSON, so that you could do the same for the rest.

devcer commented 4 years ago

@bmusuko I see that I cannot use fetch to get static files. Please go ahead and use normal import json. Assigning this to youl.