From f1b700f832e18ad137d2aeb8ef87d1e26847d860 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 20 Apr 2024 11:38:45 +0200 Subject: [PATCH] Rename /api/tokens -> /api/token --- virtweb_backend/src/main.rs | 10 +++---- virtweb_frontend/src/api/TokensApi.ts | 10 +++---- .../src/widgets/tokens/TokenRightsEditor.tsx | 28 ++++++++----------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/virtweb_backend/src/main.rs b/virtweb_backend/src/main.rs index 5e26b74..81ffae9 100644 --- a/virtweb_backend/src/main.rs +++ b/virtweb_backend/src/main.rs @@ -279,23 +279,23 @@ async fn main() -> std::io::Result<()> { ) // API tokens controller .route( - "/api/tokens/create", + "/api/token/create", web::post().to(api_tokens_controller::create), ) .route( - "/api/tokens/list", + "/api/token/list", web::get().to(api_tokens_controller::list), ) .route( - "/api/tokens/{uid}", + "/api/token/{uid}", web::get().to(api_tokens_controller::get_single), ) .route( - "/api/tokens/{uid}", + "/api/token/{uid}", web::patch().to(api_tokens_controller::update), ) .route( - "/api/tokens/{uid}", + "/api/token/{uid}", web::delete().to(api_tokens_controller::delete), ) // Static assets diff --git a/virtweb_frontend/src/api/TokensApi.ts b/virtweb_frontend/src/api/TokensApi.ts index da1dead..89e144d 100644 --- a/virtweb_frontend/src/api/TokensApi.ts +++ b/virtweb_frontend/src/api/TokensApi.ts @@ -41,7 +41,7 @@ export class TokensApi { return ( await APIClient.exec({ method: "POST", - uri: "/tokens/create", + uri: "/token/create", jsonData: n, }) ).data; @@ -54,7 +54,7 @@ export class TokensApi { return ( await APIClient.exec({ method: "GET", - uri: "/tokens/list", + uri: "/token/list", }) ).data; } @@ -66,7 +66,7 @@ export class TokensApi { return ( await APIClient.exec({ method: "GET", - uri: `/tokens/${uuid}`, + uri: `/token/${uuid}`, }) ).data; } @@ -78,7 +78,7 @@ export class TokensApi { return ( await APIClient.exec({ method: "PATCH", - uri: `/tokens/${n.id}`, + uri: `/token/${n.id}`, jsonData: n, }) ).data; @@ -90,7 +90,7 @@ export class TokensApi { static async Delete(n: APIToken): Promise { await APIClient.exec({ method: "DELETE", - uri: `/tokens/${n.id}`, + uri: `/token/${n.id}`, }); } } diff --git a/virtweb_frontend/src/widgets/tokens/TokenRightsEditor.tsx b/virtweb_frontend/src/widgets/tokens/TokenRightsEditor.tsx index a964972..e3bb8f8 100644 --- a/virtweb_frontend/src/widgets/tokens/TokenRightsEditor.tsx +++ b/virtweb_frontend/src/widgets/tokens/TokenRightsEditor.tsx @@ -475,12 +475,12 @@ export function TokenRightsEditor(p: { @@ -502,17 +502,11 @@ export function TokenRightsEditor(p: { All + + - - @@ -522,18 +516,18 @@ export function TokenRightsEditor(p: { {v.name} ))}