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'
|
'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}`, {
|
return await fetch(`https://api.anatid.net/album/${id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
import { FormEvent, MouseEvent, useState, useEffect } from 'react';
|
import { FormEvent, MouseEvent, useState, useEffect } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { Album } from '@/entities/album.entity';
|
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 Button from 'react-bootstrap/Button';
|
||||||
import Modal from 'react-bootstrap/Modal';
|
import Modal from 'react-bootstrap/Modal';
|
||||||
import { IconButton } from '@mui/material';
|
import { IconButton } from '@mui/material';
|
||||||
import { Delete, Edit } from '@mui/icons-material';
|
import { AddCircleOutline, Delete, Edit } from '@mui/icons-material';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const [albums, setAlbums] = useState<Album[]>([]);
|
const [albums, setAlbums] = useState<Album[]>([]);
|
||||||
@ -20,7 +20,7 @@ export default function Page() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchAlbums() {
|
async function fetchAlbums() {
|
||||||
const response = await fetch('https://api.anatid.net/album');
|
const response = await getAlbums();
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setAlbums(data);
|
setAlbums(data);
|
||||||
}
|
}
|
||||||
@ -71,9 +71,9 @@ export default function Page() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<Button variant="primary" onClick={handleCreate}>
|
<IconButton aria-label="Add Album" size="small" onClick={handleCreate}>
|
||||||
Add Album
|
<AddCircleOutline fontSize="small" />
|
||||||
</Button>
|
</IconButton>
|
||||||
<table className="u-full-width">
|
<table className="u-full-width">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -100,10 +100,10 @@ export default function Page() {
|
|||||||
{album.genre}
|
{album.genre}
|
||||||
</td>
|
</td>
|
||||||
<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" />
|
<Edit fontSize="small" />
|
||||||
</IconButton>
|
</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" />
|
<Delete fontSize="small" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user