Skip to content

Commit

Permalink
Update token request method to POST
Browse files Browse the repository at this point in the history
  • Loading branch information
bagus0315 committed Feb 22, 2024
1 parent bda4acb commit d6a5799
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/api/token/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NextResponse } from "next/server";
const CLIENT_ID = process.env.SPOTIFY_CLIENT_ID;
const CLIENT_SECRET = process.env.SPOTIFY_CLIENT_SECRET;

export async function GET(request, { params }) {
export const POST = async () => {
console.log("Token request received.");
console.log("CLIENT_ID", CLIENT_ID);
console.log("CLIENT_SECRET", CLIENT_SECRET);
Expand Down Expand Up @@ -32,4 +32,4 @@ export async function GET(request, { params }) {
console.log(error);
return NextResponse.error(error);
}
}
};
3 changes: 1 addition & 2 deletions components/Playlist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const Playlist = ({ playlist, limit = 40, offset = 0 }) => {
const getSongs = async (offset = 0) => {
try {
const tokenResponse = await fetch("/api/token", {
method: "GET",
cache: "no-store"
method: "POST"
});
const tokenJson = await tokenResponse.json();
const token = tokenJson.access_token;
Expand Down

0 comments on commit d6a5799

Please sign in to comment.