diff --git a/frontend/components/basic/dialog/AddServiceTokenDialog.js b/frontend/components/basic/dialog/AddServiceTokenDialog.js index d1ed17190d..f0a6314e95 100644 --- a/frontend/components/basic/dialog/AddServiceTokenDialog.js +++ b/frontend/components/basic/dialog/AddServiceTokenDialog.js @@ -33,6 +33,8 @@ const AddServiceTokenDialog = ({ closeModal, workspaceId, workspaceName, + serviceTokens, + setServiceTokens }) => { const [serviceToken, setServiceToken] = useState(""); const [serviceTokenName, setServiceTokenName] = useState(""); @@ -71,7 +73,8 @@ const AddServiceTokenDialog = ({ tag }); - setServiceToken(newServiceToken); + setServiceTokens(serviceTokens.concat([newServiceToken.serviceTokenData])); + setServiceToken(newServiceToken.serviceToken + "." + randomBytes); }; function copyToClipboard() { @@ -211,7 +214,7 @@ const AddServiceTokenDialog = ({
-
+
{ - console.log(data) const { createNotification } = useNotificationContext(); return (
- + - - - - + + + + {data?.length > 0 ? ( - data.map((row) => { + data?.map((row) => { return ( - diff --git a/frontend/pages/api/serviceToken/addServiceToken.ts b/frontend/pages/api/serviceToken/addServiceToken.ts index f006d61463..fdc8ba27cc 100644 --- a/frontend/pages/api/serviceToken/addServiceToken.ts +++ b/frontend/pages/api/serviceToken/addServiceToken.ts @@ -47,7 +47,7 @@ const addServiceToken = ({ }) }).then(async (res) => { if (res && res.status == 200) { - return (await res.json()).serviceToken; + return (await res.json()); } else { console.log('Failed to add service tokens'); } diff --git a/frontend/pages/settings/project/[id].js b/frontend/pages/settings/project/[id].js index 53c60d629f..4a41e50ff9 100644 --- a/frontend/pages/settings/project/[id].js +++ b/frontend/pages/settings/project/[id].js @@ -124,6 +124,8 @@ export default function SettingsBasic() { workspaceId={router.query.id} closeModal={closeAddServiceTokenModal} workspaceName={workspaceName} + serviceTokens={serviceTokens} + setServiceTokens={setServiceTokens} />
Token nameProjectEnvironmentValid untilTOKEN NAMEPROJECTENVIRONMENTVAILD UNTIL
+ No service tokens yet