Skip to content

Commit 724dea7

Browse files
committed
fix(web-dashboard): display API keys on empty project creation
- Correctly unwrap the new API standard { success, data, message } response in the CreateProject page. - Previously, it looked for res.data.publishableKey, but since the project object is now nested under res.data.data, it incorrectly yielded undefined, causing the UI to show empty strings.
1 parent c2ad418 commit 724dea7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/web-dashboard/src/pages/CreateProject.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ function CreateProject() {
4040
const res = await api.post(`/api/projects`,
4141
{ name, description }
4242
);
43-
const projectId = res.data?._id;
43+
const projectData = res.data.data || res.data;
44+
const projectId = projectData._id;
4445

4546
if (provisionAuth && projectId) {
4647
// Auto provision the users collection
@@ -57,11 +58,11 @@ function CreateProject() {
5758
});
5859
}
5960

60-
setNewProject(res.data);
61+
setNewProject(projectData);
6162
setActiveProjectId(projectId);
6263
toast.success("Project Created!");
6364
completeStep('create_project');
64-
if (!res.data?.apiKeysLocked) completeStep('get_api_key');
65+
if (!projectData.apiKeysLocked) completeStep('get_api_key');
6566
} catch (err) {
6667
const errorMsg = err.response?.data?.message || err.response?.data?.error || err.response?.data?.message || "Failed to create project";
6768
toast.error(typeof errorMsg === 'object' ? "Validation Error" : errorMsg);

0 commit comments

Comments
 (0)