feat: API config
This commit is contained in:
@@ -22,6 +22,25 @@ export const serverApi = createApi({
|
||||
}
|
||||
},
|
||||
}),
|
||||
getThirdPartySecret: builder.query({
|
||||
query: () => ({
|
||||
// headers: {
|
||||
// "content-type": "text/plain",
|
||||
// accept: "text/plain",
|
||||
// },
|
||||
url: `/admin/system/third_party_secret`,
|
||||
|
||||
responseHandler: (response) => response.text(),
|
||||
}),
|
||||
keepUnusedDataFor: 0,
|
||||
}),
|
||||
updateThirdPartySecret: builder.mutation({
|
||||
query: () => ({
|
||||
url: `/admin/system/third_party_secret`,
|
||||
method: "POST",
|
||||
responseHandler: (response) => response.text(),
|
||||
}),
|
||||
}),
|
||||
getMetrics: builder.query({
|
||||
query: () => ({ url: `/admin/system/metrics` }),
|
||||
}),
|
||||
@@ -145,4 +164,6 @@ export const {
|
||||
useUpdateLogoMutation,
|
||||
useCreateInviteLinkQuery,
|
||||
useLazyCreateInviteLinkQuery,
|
||||
useGetThirdPartySecretQuery,
|
||||
useUpdateThirdPartySecretMutation,
|
||||
} = serverApi;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// import React from "react";
|
||||
import styled from "styled-components";
|
||||
const Styled = styled.div`
|
||||
max-width: 500px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
gap: 15px;
|
||||
`;
|
||||
import Input from "../../common/component/styled/Input";
|
||||
import Button from "../../common/component/styled/Button";
|
||||
import {
|
||||
useGetThirdPartySecretQuery,
|
||||
useUpdateThirdPartySecretMutation,
|
||||
} from "../../app/services/server";
|
||||
export default function APIConfig() {
|
||||
const { data } = useGetThirdPartySecretQuery();
|
||||
const [
|
||||
updateSecret,
|
||||
{ data: updatedSecret },
|
||||
] = useUpdateThirdPartySecretMutation();
|
||||
console.log("secret", data);
|
||||
return (
|
||||
<Styled>
|
||||
<Input type="password" value={updatedSecret || data} />
|
||||
<Button onClick={updateSecret}>Update Secret</Button>
|
||||
</Styled>
|
||||
);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import Logins from "./config/Logins";
|
||||
import ConfigFirebase from "./config/Firebase";
|
||||
import ConfigSMTP from "./config/SMTP";
|
||||
import Notifications from "./Notifications";
|
||||
import APIConfig from "./APIConfig";
|
||||
import ManageMembers from "../../common/component/ManageMembers";
|
||||
import FAQ from "../../common/component/FAQ";
|
||||
import ConfigAgora from "./config/Agora";
|
||||
@@ -63,6 +64,11 @@ const navs = [
|
||||
title: "Social Login",
|
||||
component: <Logins />,
|
||||
},
|
||||
{
|
||||
name: "api",
|
||||
title: "API",
|
||||
component: <APIConfig />,
|
||||
},
|
||||
],
|
||||
admin: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user