1
0
Fork 0

feat: type def for youtube resource

This commit is contained in:
Ava Gaiety Wroten 2021-12-29 00:21:42 -06:00
parent 44a289266f
commit 036320a7f8
3 changed files with 30 additions and 5 deletions

19
package-lock.json generated
View file

@ -26,6 +26,7 @@
"@nuxtjs/eslint-module": "^3.0.2",
"@nuxtjs/stylelint-module": "^4.1.0",
"@nuxtjs/tailwindcss": "^4.2.1",
"@types/gapi.youtube": "^3.0.35",
"@vue/test-utils": "^1.3.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.4.4",
@ -4809,6 +4810,15 @@
"@types/gapi": "*"
}
},
"node_modules/@types/gapi.youtube": {
"version": "3.0.35",
"resolved": "https://registry.npmjs.org/@types/gapi.youtube/-/gapi.youtube-3.0.35.tgz",
"integrity": "sha512-U17CuGgwn+EiA5EWRFN3IST1s69TIDeUmvilwKmWUqoVBSfKju2bWJcaSQbxEyC05b/9F15zAd41pkfOCmhUWA==",
"dev": true,
"dependencies": {
"@types/gapi": "*"
}
},
"node_modules/@types/graceful-fs": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz",
@ -30338,6 +30348,15 @@
"@types/gapi": "*"
}
},
"@types/gapi.youtube": {
"version": "3.0.35",
"resolved": "https://registry.npmjs.org/@types/gapi.youtube/-/gapi.youtube-3.0.35.tgz",
"integrity": "sha512-U17CuGgwn+EiA5EWRFN3IST1s69TIDeUmvilwKmWUqoVBSfKju2bWJcaSQbxEyC05b/9F15zAd41pkfOCmhUWA==",
"dev": true,
"requires": {
"@types/gapi": "*"
}
},
"@types/graceful-fs": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz",

View file

@ -39,6 +39,7 @@
"@nuxtjs/eslint-module": "^3.0.2",
"@nuxtjs/stylelint-module": "^4.1.0",
"@nuxtjs/tailwindcss": "^4.2.1",
"@types/gapi.youtube": "^3.0.35",
"@vue/test-utils": "^1.3.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.4.4",

View file

@ -17,17 +17,22 @@
<script lang="ts">
import Vue from 'vue'
import { GoogleApiYouTubeActivityResource } from '@types/gapi.youtube'
export default Vue.extend({
name: 'IndexPage',
data: () => ({
data(): {
hasError: boolean
videos: GoogleApiYouTubeActivityResource[]
} {
return {
hasError: false,
videos: [],
}),
}
},
async fetch() {
/* this.videos = await fetch(`GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=50&playlistId=${process.env.YOUTUBE_UPLOADS_PLAYLIST_ID}&key=${process.env.YOUTUBE_API_KEY}`) */
try {
const response = await fetch(
`https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=50&playlistId=${process.env.YOUTUBE_UPLOADS_PLAYLIST_ID}&key=${process.env.YOUTUBE_API_KEY}`