add mongodb; store refresh token

master
adb-sh 2 years ago
parent 4b26d3aeef
commit 2b501fdeed

@ -9,23 +9,23 @@ defineProps({
<template> <template>
<div class="currentlyPlaying card"> <div class="currentlyPlaying card">
<div class="card-header"> <div class="card-header">
<b>{{ currentlyPlaying.item.name }}</b> <b>{{ currentlyPlaying?.item.name }}</b>
<div> <div>
{{ currentlyPlaying.item.artists.map(artist => artist.name).join(', ') }} {{ currentlyPlaying?.item.artists.map(artist => artist.name).join(', ') }}
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-md"> <div class="col-md">
<img :src="currentlyPlaying.item.album.images[0].url" alt="album cover" class="card-img"> <img :src="currentlyPlaying.item.album.images[0].url" alt="album cover" class="card-img">
<p> <p v-if="currentlyPlaying.context">
listening from {{ currentlyPlaying.context.type }} listening from {{ currentlyPlaying?.context.type }}
</p> </p>
</div> </div>
<div class="col-md"> <div class="col-md">
<p class="my-2"> <p class="my-2">
<a <a
:href="currentlyPlaying.item.externalURL.spotify" :href="currentlyPlaying?.item.externalURL.spotify"
target="_blank" target="_blank"
rel="noopener norefferrer" rel="noopener norefferrer"
class="btn btn-outline-dark m-1" class="btn btn-outline-dark m-1"
@ -33,12 +33,13 @@ defineProps({
view track on Spotify view track on Spotify
</a> </a>
<a <a
:href="currentlyPlaying.context.externalURL.spotify" v-if="currentlyPlaying?.context"
:href="currentlyPlaying?.context.externalURL.spotify"
target="_blank" target="_blank"
rel="noopener norefferrer" rel="noopener norefferrer"
class="btn btn-outline-dark m-1" class="btn btn-outline-dark m-1"
> >
view {{ currentlyPlaying.context.type }} on Spotify view {{ currentlyPlaying?.context.type }} on Spotify
</a> </a>
</p> </p>
</div> </div>

@ -1,5 +1,8 @@
<script setup> <script setup lang="ts">
import PromiseResolver from "@/components/PromiseResolver.vue"; import PromiseResolver from "@/components/PromiseResolver.vue";
import { useRoute } from "vue-router";
const route = useRoute();
</script> </script>
<template> <template>
@ -8,9 +11,10 @@ import PromiseResolver from "@/components/PromiseResolver.vue";
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<PromiseResolver :promise="$api.auth({ <PromiseResolver :promise="$api.auth({
code: $route.query.code, code: route.query.code,
state: $route.query.state, state: route.query.state,
})"> })">
{{ $route.query }}
<div class="alert alert-success"> <div class="alert alert-success">
Authorization completed Authorization completed
</div> </div>

@ -42,10 +42,11 @@ const route = useRoute();
<div class="card-body"> <div class="card-body">
<PromiseResolver <PromiseResolver
:promise="$api.getCurrentlyPlaying()" :promise="$api.getCurrentlyPlaying()"
v-slot="{ data: { currentlyPlaying }, update }" v-slot="{ data, update }"
class="col-md-4" class="col-md-4"
> >
<CurrentlyPlaying :currently-playing="currentlyPlaying" /> {{ data }}
<CurrentlyPlaying v-if="data.currentlyPlaying" :currentlyPlaying="data.currentlyPlaying" />
<button @click="update($api.getCurrentlyPlaying())" class="btn btn-secondary">update</button> <button @click="update($api.getCurrentlyPlaying())" class="btn btn-secondary">update</button>
</PromiseResolver> </PromiseResolver>
</div> </div>

Loading…
Cancel
Save