From 03db8e8cd600efceed9394887b900ba04e5f7684 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 7 Jun 2022 08:53:04 +0200 Subject: [PATCH] Client - update getting oauth client by id --- fittrackee_client/src/components/User/UserApps/UserApp.vue | 5 ++++- fittrackee_client/src/store/modules/oauth2/actions.ts | 6 +++--- fittrackee_client/src/store/modules/oauth2/enums.ts | 2 +- fittrackee_client/src/store/modules/oauth2/types.ts | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fittrackee_client/src/components/User/UserApps/UserApp.vue b/fittrackee_client/src/components/User/UserApps/UserApp.vue index 92ba5b23..896664f1 100644 --- a/fittrackee_client/src/components/User/UserApps/UserApp.vue +++ b/fittrackee_client/src/components/User/UserApps/UserApp.vue @@ -97,7 +97,10 @@ function loadClient() { if (route.params.clientId && typeof route.params.clientId === 'string') { - store.dispatch(OAUTH2_STORE.ACTIONS.GET_CLIENT, route.params.clientId) + store.dispatch( + OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID, + +route.params.clientId + ) } } function deleteClient(clientId: number) { diff --git a/fittrackee_client/src/store/modules/oauth2/actions.ts b/fittrackee_client/src/store/modules/oauth2/actions.ts index 56172a8f..4d234626 100644 --- a/fittrackee_client/src/store/modules/oauth2/actions.ts +++ b/fittrackee_client/src/store/modules/oauth2/actions.ts @@ -45,13 +45,13 @@ export const actions: ActionTree & IOAuth2Actions = { }) .catch((error) => handleError(context, error)) }, - [OAUTH2_STORE.ACTIONS.GET_CLIENT]( + [OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID]( context: ActionContext, - id: string + id: number ): void { context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) authApi - .get(`oauth/apps/${id}`) + .get(`oauth/apps/${id}/by_id`) .then((res) => { if (res.data.status === 'success') { context.commit( diff --git a/fittrackee_client/src/store/modules/oauth2/enums.ts b/fittrackee_client/src/store/modules/oauth2/enums.ts index 01daba7b..eff0e94e 100644 --- a/fittrackee_client/src/store/modules/oauth2/enums.ts +++ b/fittrackee_client/src/store/modules/oauth2/enums.ts @@ -2,7 +2,7 @@ export enum OAuth2Actions { CREATE_CLIENT = 'CREATE_CLIENT', DELETE_CLIENT = 'DELETE_CLIENT', GET_CLIENTS = 'GET_CLIENTS', - GET_CLIENT = 'GET_CLIENT', + GET_CLIENT_BY_ID = 'GET_CLIENT_BY_ID', } export enum OAuth2Getters { diff --git a/fittrackee_client/src/store/modules/oauth2/types.ts b/fittrackee_client/src/store/modules/oauth2/types.ts index 3ea5e852..287fe5df 100644 --- a/fittrackee_client/src/store/modules/oauth2/types.ts +++ b/fittrackee_client/src/store/modules/oauth2/types.ts @@ -29,9 +29,9 @@ export interface IOAuth2Actions { context: ActionContext, id: number ): void - [OAUTH2_STORE.ACTIONS.GET_CLIENT]( + [OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID]( context: ActionContext, - id: string + id: number ): void [OAUTH2_STORE.ACTIONS.GET_CLIENTS]( context: ActionContext,