mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-13 07:33:48 -05:00
Change API versioning to match Cup version
This commit is contained in:
@@ -39,9 +39,10 @@ pub async fn serve(port: &u16, config: &Config) -> std::io::Result<()> {
|
|||||||
App::new()
|
App::new()
|
||||||
.with_state(Arc::new(Mutex::new(data)))
|
.with_state(Arc::new(Mutex::new(data)))
|
||||||
.at("/", get(handler_service(_static)))
|
.at("/", get(handler_service(_static)))
|
||||||
.at("/api/v1/simple", get(handler_service(api_simple)))
|
.at("/api/v1/json", get(handler_service(api_simple)))
|
||||||
.at("/api/v1/full", get(handler_service(api_full)))
|
.at("/api/v3/json", get(handler_service(api_full)))
|
||||||
.at("/api/v1/refresh", get(handler_service(refresh)))
|
.at("/api/v1/refresh", get(handler_service(refresh)))
|
||||||
|
.at("/api/v3/refresh", get(handler_service(refresh)))
|
||||||
.at("/*", get(handler_service(_static)))
|
.at("/*", get(handler_service(_static)))
|
||||||
.enclosed(Logger::new())
|
.enclosed(Logger::new())
|
||||||
.serve()
|
.serve()
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { theme } from "../theme";
|
|||||||
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||||
fetch(
|
fetch(
|
||||||
process.env.NODE_ENV === "production"
|
process.env.NODE_ENV === "production"
|
||||||
? "/api/v1/full"
|
? "/api/v3/json"
|
||||||
: `http://${window.location.hostname}:8000/api/v1/full`,
|
: `http://${window.location.hostname}:8000/api/v3/json`,
|
||||||
).then((response) =>
|
).then((response) =>
|
||||||
response.json().then((data) => {
|
response.json().then((data) => {
|
||||||
onLoad(data as Data);
|
onLoad(data as Data);
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export default function RefreshButton() {
|
|||||||
request.open(
|
request.open(
|
||||||
"GET",
|
"GET",
|
||||||
process.env.NODE_ENV === "production"
|
process.env.NODE_ENV === "production"
|
||||||
? "/api/v1/refresh"
|
? "/api/v3/refresh"
|
||||||
: `http://${window.location.hostname}:8000/api/v1/refresh`,
|
: `http://${window.location.hostname}:8000/api/v3/refresh`,
|
||||||
);
|
);
|
||||||
request.send();
|
request.send();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user