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";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
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;
|
export default nextConfig;
|
||||||
|
@ -8,27 +8,8 @@ interface ReviewButton {
|
|||||||
color: ButtonOwnProps["color"]
|
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) {
|
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",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-type": "application/json",
|
"Content-type": "application/json",
|
||||||
|
@ -25,39 +25,28 @@ interface SubmissionInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
||||||
let Review: string
|
|
||||||
switch (submission_status) {
|
switch (submission_status) {
|
||||||
case SubmissionStatus.Published:
|
case SubmissionStatus.Published:
|
||||||
Review = "PUBLISHED"
|
return "PUBLISHED"
|
||||||
break
|
|
||||||
case SubmissionStatus.Rejected:
|
case SubmissionStatus.Rejected:
|
||||||
Review = "REJECTED"
|
return "REJECTED"
|
||||||
break
|
|
||||||
case SubmissionStatus.Publishing:
|
case SubmissionStatus.Publishing:
|
||||||
Review = "PUBLISHING"
|
return "PUBLISHING"
|
||||||
break
|
|
||||||
case SubmissionStatus.Validated:
|
case SubmissionStatus.Validated:
|
||||||
Review = "VALIDATED"
|
return "VALIDATED"
|
||||||
break
|
|
||||||
case SubmissionStatus.Validating:
|
case SubmissionStatus.Validating:
|
||||||
Review = "VALIDATING"
|
return "VALIDATING"
|
||||||
break
|
|
||||||
case SubmissionStatus.Accepted:
|
case SubmissionStatus.Accepted:
|
||||||
Review = "ACCEPTED"
|
return "ACCEPTED"
|
||||||
break
|
|
||||||
case SubmissionStatus.ChangesRequested:
|
case SubmissionStatus.ChangesRequested:
|
||||||
Review = "CHANGES REQUESTED"
|
return "CHANGES REQUESTED"
|
||||||
break
|
|
||||||
case SubmissionStatus.Submitted:
|
case SubmissionStatus.Submitted:
|
||||||
Review = "SUBMITTED"
|
return "SUBMITTED"
|
||||||
break
|
|
||||||
case SubmissionStatus.UnderConstruction:
|
case SubmissionStatus.UnderConstruction:
|
||||||
Review = "UNDER CONSTRUCTION"
|
return "UNDER CONSTRUCTION"
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
Review = "UNKNOWN"
|
return "UNKNOWN"
|
||||||
}
|
}
|
||||||
return Review
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
Loading…
Reference in New Issue
Block a user