Fixing handlers
Some checks failed
Music Collection CI Workflow / test (./backend) (push) Successful in 22s
Music Collection CI Workflow / test (./frontend) (push) Successful in 28s
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) Failing after 1m24s
Music Collection CI Workflow / deploy (push) Has been skipped
Some checks failed
Music Collection CI Workflow / test (./backend) (push) Successful in 22s
Music Collection CI Workflow / test (./frontend) (push) Successful in 28s
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) Failing after 1m24s
Music Collection CI Workflow / deploy (push) Has been skipped
This commit is contained in:
parent
c82afda119
commit
4aade8adc8
@ -1,6 +1,13 @@
|
||||
'use server'
|
||||
|
||||
export async function getAlbum(id: string) {
|
||||
export async function getAlbums() {
|
||||
return await fetch(`https://api.anatid.net/album/`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAlbum(id: number) {
|
||||
return await fetch(`https://api.anatid.net/album/${id}`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
@ -3,11 +3,11 @@
|
||||
import { FormEvent, MouseEvent, useState, useEffect } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Album } from '@/entities/album.entity';
|
||||
import { createAlbum, getAlbum } from '@/app/actions';
|
||||
import { createAlbum, getAlbum, getAlbums } from '@/app/actions';
|
||||
import Button from 'react-bootstrap/Button';
|
||||
import Modal from 'react-bootstrap/Modal';
|
||||
import { IconButton } from '@mui/material';
|
||||
import { Delete, Edit } from '@mui/icons-material';
|
||||
import { AddCircleOutline, Delete, Edit } from '@mui/icons-material';
|
||||
|
||||
export default function Page() {
|
||||
const [albums, setAlbums] = useState<Album[]>([]);
|
||||
@ -20,7 +20,7 @@ export default function Page() {
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchAlbums() {
|
||||
const response = await fetch('https://api.anatid.net/album');
|
||||
const response = await getAlbums();
|
||||
const data = await response.json();
|
||||
setAlbums(data);
|
||||
}
|
||||
@ -71,9 +71,9 @@ export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<Button variant="primary" onClick={handleCreate}>
|
||||
Add Album
|
||||
</Button>
|
||||
<IconButton aria-label="Add Album" size="small" onClick={handleCreate}>
|
||||
<AddCircleOutline fontSize="small" />
|
||||
</IconButton>
|
||||
<table className="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -100,10 +100,10 @@ export default function Page() {
|
||||
{album.genre}
|
||||
</td>
|
||||
<td>
|
||||
<IconButton aria-label="edit" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||
<IconButton aria-label="Edit Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||
<Edit fontSize="small" />
|
||||
</IconButton>
|
||||
<IconButton aria-label="delete" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||
<IconButton aria-label="Delete Album" size="small" id={album.id.toString()} onClick={handleEdit}>
|
||||
<Delete fontSize="small" />
|
||||
</IconButton>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user