Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion semana1/strings-arrays/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="index.js" defer></script>
<title>Boa tarde!!</title>
<title>Document</title>
</head>
<body>

Expand Down
59 changes: 59 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import axios from "axios"
// import styled from 'styled-components'

// axios.get('https://us-central1-labenu-apis.cloudfunctions.net/labefy/playlists', {
// headers: {
// "Authorization": 'mara-souza-maryam'
// }
// }).then((response) => {
// console.log(response.data)

// }).catch((error) => {
// console.log(error.response.data)
// })

const headers = {
headers: {
Authorization: "mara-souza-maryam"
}
}

const getAllPlayList = () => {
const url = "https://us-central1-labenu-apis.cloudfunctions.net/labefy/playlists"
// const headers = {
// headers: {
// Authorization: "mara-souza-maryam"
// }
// }
axios.get(url, headers)
.then((response) => {
console.log(response.data.result.list)
})
.catch((error) => {
console.log(error.response)
if (error.response.status === 401) {
console.log("Sem autorizacao")
}
})

}

const createPlaylist = (playListName) => {
const url = "https://us-central1-labenu-apis.cloudfunctions.net/labefy/playlists"
const body = {
name: "Gospel"
}
axios.post(url, body, headers)
.then((response) => {
console.log(response)
})
.catch((error) => {
alert(error.response.data.message)
})

}

// getAllPlayList()
createPlaylist("Pop")


Loading