This commit is contained in:
@@ -41,7 +41,7 @@ export default function SubmissionInfoPage() {
|
||||
|
||||
try {
|
||||
// Send the POST request
|
||||
const response = await fetch("/api/submissions-admin", {
|
||||
const response = await fetch("/v1/submissions-admin", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
|
||||
@@ -40,11 +40,11 @@ export function useReviewData({itemType, itemId}: UseReviewDataProps): UseReview
|
||||
|
||||
try {
|
||||
const [reviewData, auditData] = await Promise.all([
|
||||
fetch(`/api/${itemType}/${itemId}`).then(res => {
|
||||
fetch(`/v1/${itemType}/${itemId}`).then(res => {
|
||||
if (!res.ok) throw new Error(`Failed to fetch ${itemType.slice(0, -1)}: ${res.status}`);
|
||||
return res.json();
|
||||
}),
|
||||
fetch(`/api/${itemType}/${itemId}/audit-events?Page=1&Limit=100`).then(res => {
|
||||
fetch(`/v1/${itemType}/${itemId}/audit-events?Page=1&Limit=100`).then(res => {
|
||||
if (!res.ok) throw new Error(`Failed to fetch audit events: ${res.status}`);
|
||||
return res.json();
|
||||
})
|
||||
@@ -58,7 +58,7 @@ export function useReviewData({itemType, itemId}: UseReviewDataProps): UseReview
|
||||
}
|
||||
|
||||
try {
|
||||
const rolesResponse = await fetch("/api/session/roles");
|
||||
const rolesResponse = await fetch("/v1/session/roles");
|
||||
if (rolesResponse.ok) {
|
||||
const rolesData = await rolesResponse.json();
|
||||
setRoles(rolesData.Roles);
|
||||
@@ -72,7 +72,7 @@ export function useReviewData({itemType, itemId}: UseReviewDataProps): UseReview
|
||||
}
|
||||
|
||||
try {
|
||||
const userResponse = await fetch("/api/session/user");
|
||||
const userResponse = await fetch("/v1/session/user");
|
||||
if (userResponse.ok) {
|
||||
const userData = await userResponse.json();
|
||||
setUser(userData.UserID);
|
||||
|
||||
@@ -16,7 +16,7 @@ class ThumbnailBatcher {
|
||||
|
||||
async fetchAssetBatch(ids: number[], size: ThumbnailSize): Promise<Record<number, string>> {
|
||||
try {
|
||||
const response = await fetch('/api/thumbnails/assets', {
|
||||
const response = await fetch('/v1/thumbnails/assets', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ assetIds: ids, size }),
|
||||
@@ -43,7 +43,7 @@ class ThumbnailBatcher {
|
||||
|
||||
async fetchUserBatch(ids: number[], size: ThumbnailSize): Promise<Record<number, string>> {
|
||||
try {
|
||||
const response = await fetch('/api/thumbnails/users', {
|
||||
const response = await fetch('/v1/thumbnails/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ userIds: ids, size }),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { UserInfo } from '@/app/ts/User';
|
||||
|
||||
async function fetchUser(): Promise<UserInfo | null> {
|
||||
try {
|
||||
const response = await fetch('/api/session/user');
|
||||
const response = await fetch('/v1/session/user');
|
||||
|
||||
if (!response.ok) {
|
||||
return null;
|
||||
|
||||
@@ -88,7 +88,7 @@ export default function MapfixDetailsPage() {
|
||||
// Handle review button actions
|
||||
async function handleReviewAction(action: string, mapfixId: number) {
|
||||
try {
|
||||
const response = await fetch(`/api/mapfixes/${mapfixId}/status/${action}`, {
|
||||
const response = await fetch(`/v1/mapfixes/${mapfixId}/status/${action}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-type": "application/json",
|
||||
@@ -127,7 +127,7 @@ export default function MapfixDetailsPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/mapfixes/${mapfixId}/comment`, {
|
||||
const response = await fetch(`/v1/mapfixes/${mapfixId}/comment`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function MapfixInfoPage() {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await fetch(
|
||||
`/api/mapfixes?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`,
|
||||
`/v1/mapfixes?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`,
|
||||
{ signal: controller.signal }
|
||||
);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function MapfixInfoPage() {
|
||||
const fetchMapDetails = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetch(`/api/maps/${mapId}`);
|
||||
const response = await fetch(`/v1/maps/${mapId}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch map details: ${response.statusText}`);
|
||||
@@ -104,7 +104,7 @@ export default function MapfixInfoPage() {
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/mapfixes", {
|
||||
const response = await fetch("/v1/mapfixes", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
|
||||
@@ -59,7 +59,7 @@ export default function MapDetails() {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const res = await fetch(`/api/maps/${mapId}`);
|
||||
const res = await fetch(`/v1/maps/${mapId}`);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to fetch map: ${res.status}`);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export default function MapDetails() {
|
||||
useEffect(() => {
|
||||
async function getRoles() {
|
||||
try {
|
||||
const rolesResponse = await fetch("/api/session/roles");
|
||||
const rolesResponse = await fetch("/v1/session/roles");
|
||||
if (rolesResponse.ok) {
|
||||
const rolesData = await rolesResponse.json();
|
||||
setRoles(rolesData.Roles);
|
||||
@@ -104,7 +104,7 @@ export default function MapDetails() {
|
||||
let allMapfixes: MapfixInfo[] = [];
|
||||
let total = 0;
|
||||
do {
|
||||
const res = await fetch(`/api/mapfixes?Page=${page}&Limit=${limit}&TargetAssetID=${targetAssetId}`);
|
||||
const res = await fetch(`/v1/mapfixes?Page=${page}&Limit=${limit}&TargetAssetID=${targetAssetId}`);
|
||||
if (!res.ok) break;
|
||||
const data = await res.json();
|
||||
if (page === 1) total = data.Total;
|
||||
@@ -304,7 +304,7 @@ export default function MapDetails() {
|
||||
<IconButton
|
||||
size="small"
|
||||
component="a"
|
||||
href={`/api/maps/${mapId}/download`}
|
||||
href={`/v1/maps/${mapId}/download`}
|
||||
download={`${map?.DisplayName}.rbxm`}
|
||||
sx={{ ml: 1 }}
|
||||
>
|
||||
|
||||
@@ -147,7 +147,7 @@ export default function MapsPage() {
|
||||
let hasMore = true;
|
||||
|
||||
while (hasMore) {
|
||||
const res = await fetch(`/api/maps?Page=${page}&Limit=${requestPageSize}`);
|
||||
const res = await fetch(`/v1/maps?Page=${page}&Limit=${requestPageSize}`);
|
||||
const data: Map[] = await res.json();
|
||||
allMaps = [...allMaps, ...data];
|
||||
hasMore = data.length === requestPageSize;
|
||||
|
||||
@@ -112,7 +112,7 @@ export default function OperationStatusPage() {
|
||||
|
||||
const fetchOperation = async () => {
|
||||
try {
|
||||
const response = await fetch(`/api/operations/${operationId}`);
|
||||
const response = await fetch(`/v1/operations/${operationId}`);
|
||||
|
||||
if (!response.ok) throw new Error("Failed to fetch operation");
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function Home() {
|
||||
async function fetchMapFixes(): Promise<void> {
|
||||
setIsLoadingMapfixes(true);
|
||||
try {
|
||||
const res = await fetch(`/api/mapfixes?Page=1&Limit=${itemsPerSection}&Sort=${ListSortConstants.ListSortDateDescending}`, {
|
||||
const res = await fetch(`/v1/mapfixes?Page=1&Limit=${itemsPerSection}&Sort=${ListSortConstants.ListSortDateDescending}`, {
|
||||
signal: mapfixController.signal,
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -60,7 +60,7 @@ export default function Home() {
|
||||
async function fetchSubmissions(): Promise<void> {
|
||||
setIsLoadingSubmissions(true);
|
||||
try {
|
||||
const res = await fetch(`/api/submissions?Page=1&Limit=${itemsPerSection}&Sort=${ListSortConstants.ListSortDateDescending}`, {
|
||||
const res = await fetch(`/v1/submissions?Page=1&Limit=${itemsPerSection}&Sort=${ListSortConstants.ListSortDateDescending}`, {
|
||||
signal: submissionsController.signal,
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -77,7 +77,7 @@ export default function Home() {
|
||||
async function fetchStats(): Promise<void> {
|
||||
setIsLoadingStats(true);
|
||||
try {
|
||||
const res = await fetch(`/api/stats`, {
|
||||
const res = await fetch(`/v1/stats`, {
|
||||
signal: statsController.signal,
|
||||
});
|
||||
if (res.ok) {
|
||||
|
||||
@@ -85,7 +85,7 @@ export default function SubmissionDetailsPage() {
|
||||
// Handle review button actions
|
||||
async function handleReviewAction(action: string, submissionId: number) {
|
||||
try {
|
||||
const response = await fetch(`/api/submissions/${submissionId}/status/${action}`, {
|
||||
const response = await fetch(`/v1/submissions/${submissionId}/status/${action}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-type": "application/json",
|
||||
@@ -124,7 +124,7 @@ export default function SubmissionDetailsPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/submissions/${submissionId}/comment`, {
|
||||
const response = await fetch(`/v1/submissions/${submissionId}/comment`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function SubmissionInfoPage() {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await fetch(
|
||||
`/api/submissions?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`,
|
||||
`/v1/submissions?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`,
|
||||
{ signal: controller.signal }
|
||||
);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export default function SubmitPage() {
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/submissions", {
|
||||
const response = await fetch("/v1/submissions", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
|
||||
@@ -12,10 +12,10 @@ export default defineConfig({
|
||||
server: {
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
'/v1': {
|
||||
target: process.env.VITE_API_HOST || 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
rewrite: (path) => path.replace(/^\/v1/, ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user