Route new logins to profile until company card is filled
This commit is contained in:
@@ -521,7 +521,7 @@ export type ConsumeLoginTokenMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type ConsumeLoginTokenMutation = { __typename?: 'Mutation', consumeLoginToken: { __typename?: 'AuthSession', accessToken: string, expiresAt: any, user: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole } } };
|
||||
export type ConsumeLoginTokenMutation = { __typename?: 'Mutation', consumeLoginToken: { __typename?: 'AuthSession', accessToken: string, expiresAt: any, user: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole, company?: { __typename?: 'Company', id: string } | null } } };
|
||||
|
||||
export type RegisterSelfMutationVariables = Exact<{
|
||||
input: RegisterSelfInput;
|
||||
@@ -542,7 +542,7 @@ export type VerifyLoginCodeMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type VerifyLoginCodeMutation = { __typename?: 'Mutation', verifyLoginCode: { __typename?: 'AuthSession', accessToken: string, expiresAt: any, user: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole } } };
|
||||
export type VerifyLoginCodeMutation = { __typename?: 'Mutation', verifyLoginCode: { __typename?: 'AuthSession', accessToken: string, expiresAt: any, user: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole, company?: { __typename?: 'Company', id: string } | null } } };
|
||||
|
||||
export type ClientProductsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
@@ -621,6 +621,9 @@ export const ConsumeLoginTokenDocument = gql`
|
||||
email
|
||||
fullName
|
||||
role
|
||||
company {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,6 +726,9 @@ export const VerifyLoginCodeDocument = gql`
|
||||
email
|
||||
fullName
|
||||
role
|
||||
company {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,14 @@ const maxLoginUrl = computed(() => buildBotLoginUrl(maxBotUrl.value));
|
||||
|
||||
async function finalizeSession(accessToken: string) {
|
||||
authCookie.value = accessToken;
|
||||
}
|
||||
|
||||
async function navigateAfterLogin(user: { company?: { id: string } | null }) {
|
||||
if (!user.company?.id) {
|
||||
await navigateTo('/profile');
|
||||
return;
|
||||
}
|
||||
|
||||
await navigateTo('/products');
|
||||
}
|
||||
|
||||
@@ -146,6 +154,7 @@ async function verifyCode() {
|
||||
}
|
||||
|
||||
await finalizeSession(payload.accessToken);
|
||||
await navigateAfterLogin(payload.user);
|
||||
}
|
||||
|
||||
async function consumeLoginToken(loginToken: string) {
|
||||
@@ -160,6 +169,7 @@ async function consumeLoginToken(loginToken: string) {
|
||||
return;
|
||||
}
|
||||
await finalizeSession(payload.accessToken);
|
||||
await navigateAfterLogin(payload.user);
|
||||
}
|
||||
|
||||
function scheduleAutoRequest() {
|
||||
|
||||
Reference in New Issue
Block a user