From f6ac43aac0fd9cba686de8812eb131d825935d96 Mon Sep 17 00:00:00 2001 From: Sergio <77530549+sergi0g@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:30:07 +0200 Subject: [PATCH] Change API versioning to match Cup version --- src/server.rs | 5 +++-- web/src/components/Loading.tsx | 4 ++-- web/src/components/RefreshButton.tsx | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server.rs b/src/server.rs index 172e8d0..af58450 100644 --- a/src/server.rs +++ b/src/server.rs @@ -39,9 +39,10 @@ pub async fn serve(port: &u16, config: &Config) -> std::io::Result<()> { App::new() .with_state(Arc::new(Mutex::new(data))) .at("/", get(handler_service(_static))) - .at("/api/v1/simple", get(handler_service(api_simple))) - .at("/api/v1/full", get(handler_service(api_full))) + .at("/api/v1/json", get(handler_service(api_simple))) + .at("/api/v3/json", get(handler_service(api_full))) .at("/api/v1/refresh", get(handler_service(refresh))) + .at("/api/v3/refresh", get(handler_service(refresh))) .at("/*", get(handler_service(_static))) .enclosed(Logger::new()) .serve() diff --git a/web/src/components/Loading.tsx b/web/src/components/Loading.tsx index f2e33dc..907e337 100644 --- a/web/src/components/Loading.tsx +++ b/web/src/components/Loading.tsx @@ -6,8 +6,8 @@ import { theme } from "../theme"; export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) { fetch( process.env.NODE_ENV === "production" - ? "/api/v1/full" - : `http://${window.location.hostname}:8000/api/v1/full`, + ? "/api/v3/json" + : `http://${window.location.hostname}:8000/api/v3/json`, ).then((response) => response.json().then((data) => { onLoad(data as Data); diff --git a/web/src/components/RefreshButton.tsx b/web/src/components/RefreshButton.tsx index cd77f90..47c1232 100644 --- a/web/src/components/RefreshButton.tsx +++ b/web/src/components/RefreshButton.tsx @@ -15,8 +15,8 @@ export default function RefreshButton() { request.open( "GET", process.env.NODE_ENV === "production" - ? "/api/v1/refresh" - : `http://${window.location.hostname}:8000/api/v1/refresh`, + ? "/api/v3/refresh" + : `http://${window.location.hostname}:8000/api/v3/refresh`, ); request.send(); };