mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 23:59:35 +05:00
refactor: api routes
This commit is contained in:
parent
c74170a14d
commit
802b755d29
6 changed files with 95 additions and 55 deletions
|
@ -8,7 +8,7 @@ import { Button } from "flowbite-react";
|
|||
import { useRouter } from "next/navigation";
|
||||
|
||||
import mc from "../../../api/mc_version.json";
|
||||
import { ENDPOINTS, PACK_IMG_ENDPOINTS } from "@/api/ENDPOINTS";
|
||||
import { PACKS_ENDPOINT, PACK_ENDPOINT } from "@/api/ENDPOINTS";
|
||||
import { toast } from "react-toastify";
|
||||
const mcr = mc.reverse();
|
||||
|
||||
|
@ -52,7 +52,7 @@ export default function PackNew() {
|
|||
async function _submit() {
|
||||
const tid = toast.loading(`Creating Pack "${packInfo.title}"`)
|
||||
|
||||
const res = await fetch(`${ENDPOINTS.createPack}`, {
|
||||
const res = await fetch(PACKS_ENDPOINT("createPack"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(packInfo),
|
||||
headers: {
|
||||
|
@ -68,7 +68,7 @@ export default function PackNew() {
|
|||
}
|
||||
|
||||
if (image) {
|
||||
await fetch(`${PACK_IMG_ENDPOINTS("editPackImage", data.id)}`, {
|
||||
await fetch(`${PACK_ENDPOINT("editPackImage", data.id)}`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
image: image,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue