Change authFetch calls within TRip/MediaRequestForm.jsx to use global API_URL from config.js, remove howler.js
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import React, { useState, useEffect, useRef, Suspense, lazy } from "react";
|
||||
import { toast } from 'react-toastify';
|
||||
import { toast } from "react-toastify";
|
||||
import { Button } from "@mui/joy";
|
||||
import { Accordion, AccordionTab } from "primereact/accordion";
|
||||
import { AutoComplete } from "primereact/autocomplete";
|
||||
import BreadcrumbNav from "./BreadcrumbNav";
|
||||
|
||||
import { API_URL } from "@/config";
|
||||
|
||||
export default function MediaRequestForm() {
|
||||
const [type, setType] = useState("artist");
|
||||
@@ -47,7 +47,7 @@ export default function MediaRequestForm() {
|
||||
debounceTimeout.current = setTimeout(async () => {
|
||||
try {
|
||||
const res = await authFetch(
|
||||
`https://api.codey.lol/trip/get_artists_by_name?artist=${encodeURIComponent(
|
||||
`${API_URL}/trip/get_artists_by_name?artist=${encodeURIComponent(
|
||||
query
|
||||
)}`,
|
||||
);
|
||||
@@ -103,7 +103,7 @@ export default function MediaRequestForm() {
|
||||
|
||||
try {
|
||||
const res = await authFetch(
|
||||
`https://api.codey.lol/trip/get_albums_by_artist_id/${selectedArtist.id}`
|
||||
`${API_URL}/trip/get_albums_by_artist_id/${selectedArtist.id}`
|
||||
);
|
||||
if (!res.ok) throw new Error("API error");
|
||||
const data = await res.json();
|
||||
@@ -154,7 +154,7 @@ export default function MediaRequestForm() {
|
||||
|
||||
const handleTrackClick = async (trackId, artist, title) => {
|
||||
try {
|
||||
const res = await authFetch(`https://api.codey.lol/trip/get_track_by_id/${trackId}`);
|
||||
const res = await authFetch(`${API_URL}/trip/get_track_by_id/${trackId}`);
|
||||
if (!res.ok) throw new Error("Failed to fetch track URL");
|
||||
const data = await res.json();
|
||||
|
||||
@@ -205,7 +205,7 @@ export default function MediaRequestForm() {
|
||||
|
||||
try {
|
||||
const res = await authFetch(
|
||||
`https://api.codey.lol/trip/get_tracks_by_album_id/${album.id}`
|
||||
`${API_URL}/trip/get_tracks_by_album_id/${album.id}`
|
||||
);
|
||||
if (!res.ok) throw new Error("API error");
|
||||
const data = await res.json();
|
||||
|
Reference in New Issue
Block a user