Skip to content

Commit

Permalink
get and display daily tip allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
alelliott committed Sep 20, 2024
1 parent dd1b986 commit eb9f7dc
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/pages/HomePage/views/UsersView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,32 @@
</div>
</template>

<script lang="ts" setup>
import {
ClaimSpaceModal,
MintNogsModal,
} from '@/common'
import { ref, computed } from 'vue'
const isClaimSpaceModalShown = ref(false)
const isMintNogsModalShown = ref(false)
const dailyTipAllowance = null
const spaceTipsEarned = null
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
const totalDailyTokenAllowance = ref(0)
async function fetchTotalDailyTokenAllowance() {
try {
const response = await fetch('https://space-tip-allocator-git-main-nounspace.vercel.app/api/allocate')
const result = await response.json()
if (result.success && result.data && result.data.params) {
totalDailyTokenAllowance.value = result.data.params.totalDailyTokenAllowance
} else {
console.error('Unexpected response structure:', result)
}
} catch (error) {
console.error('Error fetching totalDailyTokenAllowance:', error)
}
}
const formattedDailyTipAllowance = computed(() => {
return new Intl.NumberFormat().format(dailyTipAllowance)
return new Intl.NumberFormat().format(totalDailyTokenAllowance.value)
})
const formattedSpaceTipsEarned = computed(() => {
return new Intl.NumberFormat().format(spaceTipsEarned)
onMounted(() => {
fetchTotalDailyTokenAllowance()
})
</script>

<style lang="scss" scoped>
Expand Down

0 comments on commit eb9f7dc

Please sign in to comment.