fix #29. amount value always positive

This commit is contained in:
Tim Gröger 2023-05-03 13:18:27 +02:00
parent 7a61dbef28
commit db4f3c45c4
1 changed files with 4 additions and 1 deletions

View File

@ -22,7 +22,7 @@
</div>
</template>
<script lang="ts">
import { defineComponent, ref, PropType, computed } from 'vue';
import { defineComponent, ref, PropType, computed, watch } from 'vue';
import { useBalanceStore } from '../store';
import { hasPermission, useUserStore } from '@flaschengeist/api';
import PERMISSIONS from '../permissions';
@ -58,6 +58,9 @@ export default defineComponent({
? <FG.User>props.user
: <FG.User>userStore.users.find((a) => a.userid === <string>props.user)
);
watch(amount, (a) => {
amount.value = Math.abs(a);
});
return { changeBalance, addShortcut, canAddCredit, amount };
},
});