반응형
Firebase Error:함수 쿼리여기서()이 유효하지 않은 데이터로 호출되었습니다.지원되지 않는 필드 값: 정의되지 않음
어디서 특정된 서류만 받고 싶습니다.
uid 속성에 등록된 이메일 주소를 신규 등록 시 Firestore에 값으로 저장합니다.
async signUp() {
const db = firebase.firestore();
await this.$store.dispatch('signUp', { username:this.username, email:this.email, password:this.password });
await db.collection('myData').doc(this.username).set({
uid: this.email,
email: this.email,
myWallet: 1000
});
this.$router.push('/home');
}
async signUp({ commit }, userInfomation) {
try {
await firebase
.auth()
.createUserWithEmailAndPassword(
userInfomation.email,
userInfomation.password
);
const user = firebase.auth().currentUser;
await user.updateProfile({
displayName: userInfomation.username,
});
commit('setUserName', user);
} catch (e) {
alert(e.message);
}
},
mutations: {
setUserName(state, user) {
state.userName = user.displayName;
},
actions: {
async getMyWallet({ commit, state }) {
const uid = state.updateUserName.email; //Information on the logged-in user is stored in updateUserName.
const db = firebase.firestore();
const doc = await db
.collection('myData')
.where('uid', '==', uid)
.get();
commit('getMyWallet', doc);
}
}
실행했을 때 제목에 오류가 표시되었습니다.
잘못 쓴 건가요?
다른 좋은 방법이 없을까요?
async getMyWallet({ commit }) {
firebase.auth().onAuthStateChanged(user => {
const uid = user.email;
const db = firebase.firestore();
const doc = db
.collection('myData')
.where('uid', '==', uid)
.get();
commit('getMyWallet', doc);
});
},
get My Wallet 부분을 다시 작성했을 때 새로운 오류가 발생하였습니다.
오류 상세: doc.data가 함수가 아닙니다.
언급URL : https://stackoverflow.com/questions/66351792/firebaseerror-function-query-where-called-with-invalid-data-unsupported-fiel
반응형
'itsource' 카테고리의 다른 글
프라이머리 키를 1000부터 시작하는 방법 (0) | 2022.09.04 |
---|---|
jQuery UI 대화상자 - 닫기 아이콘 누락 (0) | 2022.09.04 |
MySQL의 높은 CPU 사용률 (0) | 2022.09.04 |
치명적인 오류: 유효하지 않은 히프 제한 부근의 마크 콤팩트 할당 실패 - Ionic 3의 JavaScript 힙 메모리 부족 (0) | 2022.09.04 |
Pentaho 데이터 통합 SQL 연결 (0) | 2022.09.04 |