Skip to content

Instantly share code, notes, and snippets.

@robypez
Created December 10, 2021 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robypez/5578d458b6cf4694d41d614220c9ff24 to your computer and use it in GitHub Desktop.
Save robypez/5578d458b6cf4694d41d614220c9ff24 to your computer and use it in GitHub Desktop.
errore loader
<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