Client - update getting oauth client by id

This commit is contained in:
Sam 2022-06-07 08:53:04 +02:00
parent 458394fa53
commit 03db8e8cd6
4 changed files with 10 additions and 7 deletions

View File

@ -97,7 +97,10 @@
function loadClient() { function loadClient() {
if (route.params.clientId && typeof route.params.clientId === 'string') { 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) { function deleteClient(clientId: number) {

View File

@ -45,13 +45,13 @@ export const actions: ActionTree<IOAuth2State, IRootState> & IOAuth2Actions = {
}) })
.catch((error) => handleError(context, error)) .catch((error) => handleError(context, error))
}, },
[OAUTH2_STORE.ACTIONS.GET_CLIENT]( [OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID](
context: ActionContext<IOAuth2State, IRootState>, context: ActionContext<IOAuth2State, IRootState>,
id: string id: number
): void { ): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
authApi authApi
.get(`oauth/apps/${id}`) .get(`oauth/apps/${id}/by_id`)
.then((res) => { .then((res) => {
if (res.data.status === 'success') { if (res.data.status === 'success') {
context.commit( context.commit(

View File

@ -2,7 +2,7 @@ export enum OAuth2Actions {
CREATE_CLIENT = 'CREATE_CLIENT', CREATE_CLIENT = 'CREATE_CLIENT',
DELETE_CLIENT = 'DELETE_CLIENT', DELETE_CLIENT = 'DELETE_CLIENT',
GET_CLIENTS = 'GET_CLIENTS', GET_CLIENTS = 'GET_CLIENTS',
GET_CLIENT = 'GET_CLIENT', GET_CLIENT_BY_ID = 'GET_CLIENT_BY_ID',
} }
export enum OAuth2Getters { export enum OAuth2Getters {

View File

@ -29,9 +29,9 @@ export interface IOAuth2Actions {
context: ActionContext<IOAuth2State, IRootState>, context: ActionContext<IOAuth2State, IRootState>,
id: number id: number
): void ): void
[OAUTH2_STORE.ACTIONS.GET_CLIENT]( [OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID](
context: ActionContext<IOAuth2State, IRootState>, context: ActionContext<IOAuth2State, IRootState>,
id: string id: number
): void ): void
[OAUTH2_STORE.ACTIONS.GET_CLIENTS]( [OAUTH2_STORE.ACTIONS.GET_CLIENTS](
context: ActionContext<IOAuth2State, IRootState>, context: ActionContext<IOAuth2State, IRootState>,