Created
December 10, 2021 23:00
-
-
Save robypez/5578d458b6cf4694d41d614220c9ff24 to your computer and use it in GitHub Desktop.
errore loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import { | |
defineProps, | |
onMounted, | |
ref, | |
computed | |
} from 'vue'; | |
import axios from 'axios' | |
const props = defineProps({ | |
publicKey: String | |
}) | |
const tokens = ref([]) | |
const loadingState = ref(null) | |
const showToken = computed(() => loadingState.value === 'success' ) | |
// Fetch Data Feature | |
const fetchAllTokens = () => { | |
console.log(showToken.value); | |
loadingState.value = 'loading' | |
const url = `https://api.gogoog.io/account/${props.publicKey}/token/data` | |
return axios.get(url) | |
.then(response => { | |
loadingState.value = 'success' | |
tokens.value = response.data | |
console.log(showToken.value); | |
}) | |
} | |
onMounted( | |
fetchAllTokens() | |
); | |
</script> | |
<template> | |
<div v-if="showToken.value"> | |
<div class="row"> | |
<div v-for="token in tokens.value.nfts" v-bind:key="token.id" class="col-lg-4 col-md-6 col-12 mb-4 pb-2"> | |
<router-link :to="{ name: 'Token', params: { id: token.id }}"> | |
.... | |
</router-link> | |
</div> | |
</div> | |
</div> | |
<div v-else> | |
<div class="row loading"> | |
<div class='anim-circle'></div> | |
</div> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment