Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: use user from cookie for signup path (#4100)

Danny Xu848d27a20d1d
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index a6a96e9fe2..fdddf1be3c 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -74,19 +74,20 @@ export const useAuthStore = defineStore("auth", {
return unknownPrincipal;
},
async signup(signupInfo: SignupInfo) {
- const newUser = (
- await axios.post("/api/auth/signup", {
- data: { type: "signupInfo", attributes: signupInfo },
- })
- ).data.data;
+ await axios.post("/api/auth/signup", {
+ data: { type: "signupInfo", attributes: signupInfo },
+ });
- // Refresh the corresponding principal
- await usePrincipalStore().fetchPrincipalById(newUser.id);
+ const userId = getIntCookie("user");
+ if (userId) {
+ const loggedInUser = await usePrincipalStore().fetchPrincipalById(
+ userId
+ );
- // The conversion relies on the above refresh.
- const convertedUser = convert(newUser);
- this.setCurrentUser(convertedUser);
- return convertedUser;
+ this.setCurrentUser(loggedInUser);
+ return loggedInUser;
+ }
+ return unknown("PRINCIPAL") as Principal;
},
async activate(activateInfo: ActivateInfo) {
const activatedUser = (