web: proxy the dev port 3000 to 8081 for api calls
This commit is contained in:
parent
d37cc9cdf2
commit
a2c6981d36
@ -1,7 +1,15 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
distDir: "build"
|
||||
distDir: "build",
|
||||
rewrites: async () => {
|
||||
return [
|
||||
{
|
||||
source: "/v1/submissions/1/status/:statustype",
|
||||
destination: "http://localhost:8081/v1/submissions/:statustype"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
@ -8,27 +8,8 @@ interface ReviewButton {
|
||||
color: ButtonOwnProps["color"]
|
||||
}
|
||||
|
||||
// CREATE:
|
||||
// curl -H 'Content-Type: application/json' \
|
||||
// --cookie "session_id=123" \
|
||||
// -d '{"ID":0,"DisplayName":"Example Map","Creator":"Quaternions","GameID":1,"Date":"2024-12-09T20:43:49.957660142-08:00","Submitter":52250025,"AssetID":255299419,"AssetVersion":7,"Completed":true,"TargetAssetID":5692134283,"StatusID":0}' \
|
||||
// -X POST \
|
||||
// localhost:8081/v1/submissions
|
||||
|
||||
// GET:
|
||||
// curl -H 'Content-Type: application/json' \
|
||||
// --cookie "session_id=c5191ddc-eee1-4010-900c-6b2c7b6780ab" \
|
||||
// -X GET \
|
||||
// localhost:8081/v1/submissions/1
|
||||
|
||||
// SUBMIT:
|
||||
// curl -H 'Content-Type: application/json' \
|
||||
// --cookie "session_id=c5191ddc-eee1-4010-900c-6b2c7b6780ab" \
|
||||
// -X POST \
|
||||
// localhost:8081/v1/submissions/1/status/submit
|
||||
|
||||
function ReviewButtonClicked(action: Action) {
|
||||
const post = fetch(`http://localhost:8081/v1/submissions/1/status/${action}`, {
|
||||
const post = fetch(`http://localhost:3000/v1/submissions/1/status/${action}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-type": "application/json",
|
||||
|
@ -25,39 +25,28 @@ interface SubmissionInfo {
|
||||
}
|
||||
|
||||
function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
||||
let Review: string
|
||||
switch (submission_status) {
|
||||
case SubmissionStatus.Published:
|
||||
Review = "PUBLISHED"
|
||||
break
|
||||
return "PUBLISHED"
|
||||
case SubmissionStatus.Rejected:
|
||||
Review = "REJECTED"
|
||||
break
|
||||
return "REJECTED"
|
||||
case SubmissionStatus.Publishing:
|
||||
Review = "PUBLISHING"
|
||||
break
|
||||
return "PUBLISHING"
|
||||
case SubmissionStatus.Validated:
|
||||
Review = "VALIDATED"
|
||||
break
|
||||
return "VALIDATED"
|
||||
case SubmissionStatus.Validating:
|
||||
Review = "VALIDATING"
|
||||
break
|
||||
return "VALIDATING"
|
||||
case SubmissionStatus.Accepted:
|
||||
Review = "ACCEPTED"
|
||||
break
|
||||
return "ACCEPTED"
|
||||
case SubmissionStatus.ChangesRequested:
|
||||
Review = "CHANGES REQUESTED"
|
||||
break
|
||||
return "CHANGES REQUESTED"
|
||||
case SubmissionStatus.Submitted:
|
||||
Review = "SUBMITTED"
|
||||
break
|
||||
return "SUBMITTED"
|
||||
case SubmissionStatus.UnderConstruction:
|
||||
Review = "UNDER CONSTRUCTION"
|
||||
break
|
||||
return "UNDER CONSTRUCTION"
|
||||
default:
|
||||
Review = "UNKNOWN"
|
||||
return "UNKNOWN"
|
||||
}
|
||||
return Review
|
||||
}
|
||||
|
||||
export {
|
||||
|
Loading…
Reference in New Issue
Block a user