mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix saving coin animation
This commit is contained in:
parent
f51664807a
commit
7acda32c7d
@ -2,9 +2,6 @@ import { ArgsType, Field } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class UpdateUserInfosArgs {
|
||||
@Field(() => String)
|
||||
email!: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
firstName?: string
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ export class UserSettingRepository extends Repository<UserSetting> {
|
||||
async readBoolean(userId: number, key: Setting): Promise<boolean> {
|
||||
const entity = await this.findOne({ userId: userId, key: key })
|
||||
if (!entity || !isStringBoolean(entity.value)) {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
return entity.value.toLowerCase() === 'true'
|
||||
}
|
||||
|
||||
@ -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) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user