Coder Social home page Coder Social logo

firestore-parser's People

Contributors

dependabot[bot] avatar jdbence avatar rappayne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

firestore-parser's Issues

Re Different Firestore result than the one in your example

I logged another call but I think it has nothing to do with axios but with the result I am getting back that need to be parsed. My result is different from yours.

{ "name": "projects/midrandchapel/databases/(default)/documents/about/lFFDPtq5T61BufAOBio0", "fields": { "actions": { "arrayValue": { "values": [ { "mapValue": { "fields": { "text": { "stringValue": "Contact Us" }, "to": { "stringValue": "/contact" }, "color": { "stringValue": "primary darken-4" } } } } ] } }, "md": { "integerValue": "6" }, "showimg": { "booleanValue": true }, "cols": { "integerValue": "12" }, "lg": { "integerValue": "3" }, "subtitle": { "stringValue": "Subtitle or text goes here" }, "xl": { "integerValue": "2" }, "to": { "stringValue": "about/imnew" }, "xs": { "integerValue": "12" }, "text": { "stringValue": "text goes here" }, "sm": { "integerValue": "12" }, "srcavatar": { "stringValue": "https://picsum.photos/id/1005/50/50" }, "title": { "stringValue": "I'm New" }, "src": { "stringValue": "https://picsum.photos/id/1005/5760/3840" }, "page": { "stringValue": "about" }, "sortorder": { "integerValue": "0" } }, "createTime": "2020-04-06T16:18:59.477042Z", "updateTime": "2020-04-08T05:55:02.021686Z" }

arrayValue can be empty object

arrayValue not always has values field. So code can crash:

TypeError: Cannot read property 'map' of undefined

See line 12 of index.js

mapValue does not have `fields` when empty

Hi! New bug report is here. When you have "field_name": {} in your database, it translates to mapValue: {} in REST response, so does not have fields field, which is expected in your code when parsing mapValue.

As a result we have "unidentified" passed into getFireStoreProp function and crash.

Types

@jdbence, would you mind sharing the types you used to parse the data?

Nuxt and axios

I am trying to run this on nuxt and axios, and are getting the error that "response.json" is not a function. Please see my code below

getRecords2(vuexContext, context) { let projectId = context.Firestore.projectId || process.env.projectId let url = process.env.fireStoreURL + 'projects/' + projectId + '/databases/(default)/documents/' + context.Firestore.path const token = vuexContext.rootState.auth.token const config = { headers: { Authorization: Bearer ${token} } } this.$axios .$get(url, config) .then(response => response.json()) .then(json => FireStoreParser(json)) .then(json => console.log(json)) }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.