Client:OAuth: fix update client
This commit is contained in:
parent
55d7b5e500
commit
d5fd4a7868
@ -114,6 +114,7 @@ const ClientForm = ({
|
||||
if (!requiredErrorFields.includes(key))
|
||||
setRequiredErrorFields((s) => [...s, key]);
|
||||
|
||||
console.log(key);
|
||||
isValid = false;
|
||||
}
|
||||
isValid = isValid && !errorFields.includes(key);
|
||||
@ -130,11 +131,13 @@ const ClientForm = ({
|
||||
isValid = false;
|
||||
}
|
||||
isValid = isValid && !errorFields.includes(key);
|
||||
|
||||
console.log(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(isValid);
|
||||
|
||||
if (!isValid) return;
|
||||
|
||||
setIsRequestRunning(true);
|
||||
|
@ -33,6 +33,8 @@ import PencilReactSvgUrl from "PUBLIC_DIR/images/pencil.react.svg?url";
|
||||
import CodeReactSvgUrl from "PUBLIC_DIR/images/code.react.svg?url";
|
||||
import ExternalLinkReactSvgUrl from "PUBLIC_DIR/images/external.link.react.svg?url";
|
||||
import OauthRevokeSvgUrl from "PUBLIC_DIR/images/oauth.revoke.svg?url";
|
||||
import { transformToClientProps } from "@docspace/common/utils/oauth";
|
||||
import { AuthenticationMethod } from "@docspace/common/utils/oauth/enums";
|
||||
|
||||
const PAGE_LIMIT = 100;
|
||||
|
||||
@ -348,16 +350,27 @@ class OAuthStore implements OAuthStoreProps {
|
||||
|
||||
updateClient = async (clientId: string, client: IClientReqDTO) => {
|
||||
try {
|
||||
const newClient = await updateClient(clientId, client);
|
||||
await updateClient(clientId, client);
|
||||
|
||||
const idx = this.clients.findIndex((c) => c.clientId === clientId);
|
||||
|
||||
const newClient = { ...this.clients[idx] };
|
||||
|
||||
newClient.name = client.name;
|
||||
newClient.allowedOrigins = client.allowed_origins;
|
||||
newClient.logo = client.logo;
|
||||
newClient.description = client.description;
|
||||
|
||||
if (
|
||||
client.allow_pkce &&
|
||||
!newClient.authenticationMethods.includes(AuthenticationMethod.none)
|
||||
)
|
||||
newClient.authenticationMethods.push(AuthenticationMethod.none);
|
||||
|
||||
if (idx > -1) {
|
||||
runInAction(() => {
|
||||
this.clients[idx] = {
|
||||
...newClient,
|
||||
creatorAvatar: this.clients[idx].creatorAvatar,
|
||||
creatorDisplayName: this.clients[idx].creatorDisplayName,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -72,17 +72,12 @@ export const addClient = async (data: IClientReqDTO): Promise<IClientProps> => {
|
||||
return transformToClientProps(client);
|
||||
};
|
||||
|
||||
export const updateClient = async (
|
||||
clientId: string,
|
||||
data: IClientReqDTO
|
||||
): Promise<IClientProps> => {
|
||||
export const updateClient = async (clientId: string, data: IClientReqDTO) => {
|
||||
const client: IClientResDTO = await request({
|
||||
method: "put",
|
||||
url: `/clients/${clientId}`,
|
||||
data,
|
||||
});
|
||||
|
||||
return transformToClientProps(client);
|
||||
};
|
||||
|
||||
export const changeClientStatus = async (
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"date": "20231215_102541",
|
||||
"date": "20231221_132646",
|
||||
"checksums": {
|
||||
"api.js": "47725bc876523672712707c384e3cab2",
|
||||
"api.js": "27c5244c5921b801b763349ae4c711f5",
|
||||
"api.poly.js": "586ce6831fa68f6bc33486e2cebc856e",
|
||||
"browserDetector.js": "9e853f32d806dd83652ccc2d67510a84",
|
||||
"config.json": "3f54595a6ea8207c37f1197069a2db86",
|
||||
|
Loading…
Reference in New Issue
Block a user