diff --git a/backend/src/graphql/args/UpdateUserInfosArgs.ts b/backend/src/graphql/args/UpdateUserInfosArgs.ts index a77c7b7dc..dca9ec4ab 100644 --- a/backend/src/graphql/args/UpdateUserInfosArgs.ts +++ b/backend/src/graphql/args/UpdateUserInfosArgs.ts @@ -2,9 +2,6 @@ import { ArgsType, Field } from 'type-graphql' @ArgsType() export default class UpdateUserInfosArgs { - @Field(() => String) - email!: string - @Field({ nullable: true }) firstName?: string diff --git a/backend/src/graphql/resolvers/UserResolver.ts b/backend/src/graphql/resolvers/UserResolver.ts index 844ec488f..e527285eb 100644 --- a/backend/src/graphql/resolvers/UserResolver.ts +++ b/backend/src/graphql/resolvers/UserResolver.ts @@ -181,30 +181,35 @@ export class UserResolver { ) { const result = await apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) if (!result.success) throw new Error(result.data) - response = new UpdateUserInfosResponse(result.data) + response = new UpdateUserInfosResponse(result.data) } - - if (coinanimation) { + console.log("before coinaimation, coinanimation: %o", coinanimation) + if (coinanimation !== undefined) { // load user and balance const userRepository = getCustomRepository(UserRepository) - const userEntity = await userRepository.findByPubkeyHex(context.pubkey) - + console.log("get user repository") + console.log("try to find: %o", context.pubKey) + const userEntity = await userRepository.findByPubkeyHex(context.pubKey) + console.log("user entity: %o", userEntity ) const userSettingRepository = getCustomRepository(UserSettingRepository) userSettingRepository .setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString()) .catch((error) => { throw new Error(error) }) - + if (!response) { + console.log("new response") response = new UpdateUserInfosResponse({ valid_values: 1 }) } else { response.validValues++ } + console.log("response should be set") } if (!response) { throw new Error('no valid response') } + console.log(response) return response } diff --git a/backend/src/typeorm/repository/UserSettingRepository.ts b/backend/src/typeorm/repository/UserSettingRepository.ts index 2b8ab2729..7ac01d7c5 100644 --- a/backend/src/typeorm/repository/UserSettingRepository.ts +++ b/backend/src/typeorm/repository/UserSettingRepository.ts @@ -27,7 +27,7 @@ export class UserSettingRepository extends Repository { async readBoolean(userId: number, key: Setting): Promise { const entity = await this.findOne({ userId: userId, key: key }) if (!entity || !isStringBoolean(entity.value)) { - return false + return true } return entity.value.toLowerCase() === 'true' } diff --git a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue index 4040823d6..11c0fc823 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_CoinAnimation.vue @@ -48,14 +48,15 @@ export default { .mutate({ mutation: updateUserInfos, variables: { - coinanimation: this.$store.state.coinanimation, + coinanimation: this.CoinAnimationStatus, }, }) .then(() => { + this.$store.state.coinanimation = this.CoinAnimationStatus this.$toasted.success( this.CoinAnimationStatus - ? this.$t('setting.coinanimationTrue') - : this.$t('setting.coinanimationFalse'), + ? this.$t('settings.coinanimation.True') + : this.$t('settings.coinanimation.False'), ) }) .catch((error) => {