Reworking actions
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 21s
Music Collection CI Workflow / test (./frontend) (push) Successful in 27s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/msuic-collection-backend, ./backend) (push) Successful in 49s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m43s
Music Collection CI Workflow / deploy (push) Successful in 23s
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 21s
Music Collection CI Workflow / test (./frontend) (push) Successful in 27s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/msuic-collection-backend, ./backend) (push) Successful in 49s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m43s
Music Collection CI Workflow / deploy (push) Successful in 23s
This commit is contained in:
parent
4aade8adc8
commit
b5b3774e58
@ -57,6 +57,20 @@ export async function deleteAlbum(formData: FormData) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getSongs() {
|
||||||
|
return await fetch(`https://api.anatid.net/song/`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getSong(id: number) {
|
||||||
|
return await fetch(`https://api.anatid.net/song/${id}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function createSong(formData: FormData) {
|
export async function createSong(formData: FormData) {
|
||||||
const albumId = formData.get('album-id');
|
const albumId = formData.get('album-id');
|
||||||
const title = formData.get('title');
|
const title = formData.get('title');
|
||||||
|
@ -5,7 +5,7 @@ import { useParams } from 'next/navigation'
|
|||||||
import { Album } from '@/entities/album.entity';
|
import { Album } from '@/entities/album.entity';
|
||||||
import { Song } from '@/entities/song.entity';
|
import { Song } from '@/entities/song.entity';
|
||||||
import { TimeUtils } from '@/utils/time.util';
|
import { TimeUtils } from '@/utils/time.util';
|
||||||
import { createSong } from '@/app/actions';
|
import { createSong, getAlbum } from '@/app/actions';
|
||||||
import Button from 'react-bootstrap/Button';
|
import Button from 'react-bootstrap/Button';
|
||||||
import Modal from 'react-bootstrap/Modal';
|
import Modal from 'react-bootstrap/Modal';
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export default function Page() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchAlbum(id: string) {
|
async function fetchAlbum(id: string) {
|
||||||
const response = await fetch(`https://api.anatid.net/album/${id}`);
|
const response = await getAlbum(parseInt(id));
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setAlbum(data);
|
setAlbum(data);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ export default function Page() {
|
|||||||
const id = event.currentTarget.getAttribute('id');
|
const id = event.currentTarget.getAttribute('id');
|
||||||
if (id) {
|
if (id) {
|
||||||
try {
|
try {
|
||||||
const response = await getAlbum(id);
|
const response = await getAlbum(parseInt(id));
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setFormAlbumTitle(data.title);
|
setFormAlbumTitle(data.title);
|
||||||
setFormAlbumArtist(data.artist);
|
setFormAlbumArtist(data.artist);
|
||||||
@ -71,8 +71,8 @@ export default function Page() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<IconButton aria-label="Add Album" size="small" onClick={handleCreate}>
|
<IconButton aria-label="Add Album" size="large" onClick={handleCreate}>
|
||||||
<AddCircleOutline fontSize="small" />
|
<AddCircleOutline/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<table className="u-full-width">
|
<table className="u-full-width">
|
||||||
<thead>
|
<thead>
|
||||||
@ -101,10 +101,10 @@ export default function Page() {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<IconButton aria-label="Edit Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
<IconButton aria-label="Edit Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||||
<Edit fontSize="small" />
|
<Edit/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton aria-label="Delete Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
<IconButton aria-label="Delete Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||||
<Delete fontSize="small" />
|
<Delete/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user