This commit is contained in:
Аришина) 2024-09-18 00:14:53 +04:00
parent 2154b90498
commit c6819a2511
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,8 @@
import axios from "axios"; import axios from "axios";
import { IAdvertisement, IGenre, IPlaylist, ISong } from "../models/IModels"; import { IAdvertisement, IGenre, IPlaylist, ISong } from "../models/IModels";
const localhost = process.env.REACT_APP_LOCALHOST || 'http://localhost:3000';
export function getPlaylistsByGenre(genre: string, playlists: IPlaylist[]) { export function getPlaylistsByGenre(genre: string, playlists: IPlaylist[]) {
return playlists.filter((playlist: IPlaylist) => playlist.genres.includes(genre)); return playlists.filter((playlist: IPlaylist) => playlist.genres.includes(genre));
@ -8,13 +10,12 @@ export function getPlaylistsByGenre(genre: string, playlists: IPlaylist[]) {
export async function getPlaylists() { export async function getPlaylists() {
return await axios.get<IPlaylist[]>('playlists'); return await axios.get<IPlaylist[]>(`${localhost}playlists`);
} }
export async function getPlaylist(id: string) { export async function getPlaylist(id: string) {
return await axios.get<IPlaylist[]>('http://localhost:3000/playlists/' + id); return await axios.get<IPlaylist[]>(`${localhost}playlists/` + id);
} }

View File

@ -4,7 +4,7 @@ import { UserOutlined } from '@ant-design/icons';
export function Header() { export function Header() {
return ( return (
<div className="flex items-center justify-between p-4 border-b bg-gradient-to-bl from-red-800 to-red-600 border-solid border-2 border-slate-100"> <div className="flex items-center justify-between p-4 border-b bg-gradient-to-bl from-red-900 to-red-600 border-solid border-2 border-slate-100">
<h1 className="text-3xl font-bold">😈 DEVIL music</h1> <h1 className="text-3xl font-bold">😈 DEVIL music</h1>
<Button href="/login" style={{ width: 30, height: 30 }}> <Button href="/login" style={{ width: 30, height: 30 }}>
<UserOutlined /> <UserOutlined />