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()
|
@ArgsType()
|
||||||
export default class UpdateUserInfosArgs {
|
export default class UpdateUserInfosArgs {
|
||||||
@Field(() => String)
|
|
||||||
email!: string
|
|
||||||
|
|
||||||
@Field({ nullable: true })
|
@Field({ nullable: true })
|
||||||
firstName?: string
|
firstName?: string
|
||||||
|
|
||||||
|
|||||||
@ -181,30 +181,35 @@ export class UserResolver {
|
|||||||
) {
|
) {
|
||||||
const result = await apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload)
|
const result = await apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload)
|
||||||
if (!result.success) throw new Error(result.data)
|
if (!result.success) throw new Error(result.data)
|
||||||
response = new UpdateUserInfosResponse(result.data)
|
response = new UpdateUserInfosResponse(result.data)
|
||||||
}
|
}
|
||||||
|
console.log("before coinaimation, coinanimation: %o", coinanimation)
|
||||||
if (coinanimation) {
|
if (coinanimation !== undefined) {
|
||||||
// load user and balance
|
// load user and balance
|
||||||
const userRepository = getCustomRepository(UserRepository)
|
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)
|
const userSettingRepository = getCustomRepository(UserSettingRepository)
|
||||||
userSettingRepository
|
userSettingRepository
|
||||||
.setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString())
|
.setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString())
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw new Error(error)
|
throw new Error(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
|
console.log("new response")
|
||||||
response = new UpdateUserInfosResponse({ valid_values: 1 })
|
response = new UpdateUserInfosResponse({ valid_values: 1 })
|
||||||
} else {
|
} else {
|
||||||
response.validValues++
|
response.validValues++
|
||||||
}
|
}
|
||||||
|
console.log("response should be set")
|
||||||
}
|
}
|
||||||
if (!response) {
|
if (!response) {
|
||||||
throw new Error('no valid response')
|
throw new Error('no valid response')
|
||||||
}
|
}
|
||||||
|
console.log(response)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export class UserSettingRepository extends Repository<UserSetting> {
|
|||||||
async readBoolean(userId: number, key: Setting): Promise<boolean> {
|
async readBoolean(userId: number, key: Setting): Promise<boolean> {
|
||||||
const entity = await this.findOne({ userId: userId, key: key })
|
const entity = await this.findOne({ userId: userId, key: key })
|
||||||
if (!entity || !isStringBoolean(entity.value)) {
|
if (!entity || !isStringBoolean(entity.value)) {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
return entity.value.toLowerCase() === 'true'
|
return entity.value.toLowerCase() === 'true'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,14 +48,15 @@ export default {
|
|||||||
.mutate({
|
.mutate({
|
||||||
mutation: updateUserInfos,
|
mutation: updateUserInfos,
|
||||||
variables: {
|
variables: {
|
||||||
coinanimation: this.$store.state.coinanimation,
|
coinanimation: this.CoinAnimationStatus,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
this.$store.state.coinanimation = this.CoinAnimationStatus
|
||||||
this.$toasted.success(
|
this.$toasted.success(
|
||||||
this.CoinAnimationStatus
|
this.CoinAnimationStatus
|
||||||
? this.$t('setting.coinanimationTrue')
|
? this.$t('settings.coinanimation.True')
|
||||||
: this.$t('setting.coinanimationFalse'),
|
: this.$t('settings.coinanimation.False'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user