Skip to content
Advertisement

Tag: firebase

How do I get data from Firebase collection using NextJs API, Firebase Firestore, axios and TypeScript?

I’m using api routes in NextJS 13, to fetch data from Firebase like this(api/locations.tsx): Then I have a component Locations.tsx where I’m trying to store the locations in locations state object like this: But I’m getting an error Property ‘locationsData’ does not exist on type ‘GetLocationResponse’. even though I tried adding “locationsData” to my type definition type GetLocationResponse = {

How to delete a field inside Firestore document – The field’s key contains dots

I am trying to delete a field inside a Firestore document using the KeyPath method. In other words, I am converting the request body into keyPath string. Example, converting the below request body: Into keyPath: “preferences.settings.v1.4.3” and then using this keyPath to delete the path using the following method This would work normally if the keyPath string doesn’t contains dots.

Function does not return true even if it goes through

I can’t seem to make this work but I want to return true every-time the function executes successfully, which in this case is “Changing the password”. The res variable when called by other functions always results in false even though I see the toast message “Password changed successfully”. The if condition in above code never executes because res is always

I want to connect react and firebase

I have problem with Firebase and React. This problem is after click to my add-data button for adding data to database. I get this console.log Reference_impl.ts:482 Uncaught TypeError: db._checkNotDeleted is not a function at ref (Reference_impl.ts:482:1) at insertData (Modal.js:44:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1) at invokeGuardedCallback (react-dom.development.js:4277:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1) at executeDispatch (react-dom.development.js:9041:1) at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1) at processDispatchQueue (react-dom.development.js:9086:1)

Advertisement