Reworking actions
All checks were successful
Music Collection CI Workflow / test (./frontend) (push) Successful in 27s
Music Collection CI Workflow / test (./backend) (push) Successful in 22s
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 1m42s
Music Collection CI Workflow / deploy (push) Successful in 23s
All checks were successful
Music Collection CI Workflow / test (./frontend) (push) Successful in 27s
Music Collection CI Workflow / test (./backend) (push) Successful in 22s
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 1m42s
Music Collection CI Workflow / deploy (push) Successful in 23s
This commit is contained in:
parent
b078afc2af
commit
1d111cfeff
@ -1,4 +0,0 @@
|
|||||||
[ZoneTransfer]
|
|
||||||
ZoneId=3
|
|
||||||
ReferrerUrl=https://www.flaticon.com/free-icon/pencil_1828911?term=edit&page=1&position=5&origin=tag&related_id=1828911
|
|
||||||
HostUrl=https://www.flaticon.com/download/icon/1828911?icon_id=1828911&author=190&team=190&keyword=Pencil&pack=1828720&style=Filled&style_id=863&format=png&color=%23000000&colored=1&size=512&selection=1&type=standard&search=edit
|
|
@ -1,13 +1,17 @@
|
|||||||
'use server'
|
'use server'
|
||||||
|
|
||||||
export async function getAlbums() {
|
export async function getAlbums() {
|
||||||
return fetch('https://api.anatid.net/album');
|
return fetch('https://api.anatid.net/album').then(response => {
|
||||||
|
return response.json();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAlbum(id: number) {
|
export async function getAlbum(id: number) {
|
||||||
return fetch(`https://api.anatid.net/album/${id}`, {
|
return fetch(`https://api.anatid.net/album/${id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +27,8 @@ export async function createAlbum(formData: FormData) {
|
|||||||
artist: artist,
|
artist: artist,
|
||||||
genre: genre,
|
genre: genre,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +46,8 @@ export async function updateAlbum(formData: FormData) {
|
|||||||
artist: artist,
|
artist: artist,
|
||||||
genre: genre,
|
genre: genre,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +59,8 @@ export async function deleteAlbum(formData: FormData) {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: id,
|
id: id,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +72,8 @@ export async function getSong(id: number) {
|
|||||||
return fetch(`https://api.anatid.net/song/${id}`, {
|
return fetch(`https://api.anatid.net/song/${id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +89,8 @@ export async function createSong(formData: FormData) {
|
|||||||
title: title,
|
title: title,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +108,8 @@ export async function updateSong(formData: FormData) {
|
|||||||
title: title,
|
title: title,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,5 +121,7 @@ export async function deleteSong(formData: FormData) {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: id,
|
id: id,
|
||||||
})
|
})
|
||||||
|
}).then(response => {
|
||||||
|
return response.json();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ export default function Page() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchAlbum(id: string) {
|
async function fetchAlbum(id: string) {
|
||||||
try {
|
try {
|
||||||
const response = await getAlbum(parseInt(id));
|
const data = await getAlbum(parseInt(id));
|
||||||
const data = await response.json();
|
|
||||||
setAlbum(data);
|
setAlbum(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error getting album with id ${id}`, error);
|
console.error(`Error getting album with id ${id}`, error);
|
||||||
@ -37,8 +36,7 @@ export default function Page() {
|
|||||||
|
|
||||||
const formData = new FormData(event.currentTarget);
|
const formData = new FormData(event.currentTarget);
|
||||||
try {
|
try {
|
||||||
const response = await createSong(formData);
|
const data = await createSong(formData);
|
||||||
const data = response.json();
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error creating Song:', error);
|
console.error('Error creating Song:', error);
|
||||||
|
@ -23,8 +23,7 @@ export default function Page() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchAlbums() {
|
async function fetchAlbums() {
|
||||||
try {
|
try {
|
||||||
const response = await getAlbums();
|
const data = await getAlbums();
|
||||||
const data = await response.json();
|
|
||||||
setAlbums(data);
|
setAlbums(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error getting albums: ", error);
|
console.error("Error getting albums: ", error);
|
||||||
@ -40,12 +39,10 @@ export default function Page() {
|
|||||||
const formData = new FormData(event.currentTarget);
|
const formData = new FormData(event.currentTarget);
|
||||||
try {
|
try {
|
||||||
if (!formData.get('id')) {
|
if (!formData.get('id')) {
|
||||||
const response = await createAlbum(formData);
|
const data = await createAlbum(formData);
|
||||||
const data = await response.json();
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
} else {
|
} else {
|
||||||
const response = await updateAlbum(formData);
|
const data = await updateAlbum(formData);
|
||||||
const data = await response.json();
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -66,8 +63,7 @@ export default function Page() {
|
|||||||
const id = event.currentTarget.getAttribute('album-id');
|
const id = event.currentTarget.getAttribute('album-id');
|
||||||
if (id) {
|
if (id) {
|
||||||
try {
|
try {
|
||||||
const response = await getAlbum(parseInt(id));
|
const data = await getAlbum(parseInt(id));
|
||||||
const data = await response.json();
|
|
||||||
setFormModalTitle("Edit Album");
|
setFormModalTitle("Edit Album");
|
||||||
setFormAlbumId(data.id)
|
setFormAlbumId(data.id)
|
||||||
setFormAlbumTitle(data.title);
|
setFormAlbumTitle(data.title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user