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<{
|
export type RegisterSelfMutationVariables = Exact<{
|
||||||
input: RegisterSelfInput;
|
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; }>;
|
export type ClientProductsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
@@ -621,6 +621,9 @@ export const ConsumeLoginTokenDocument = gql`
|
|||||||
email
|
email
|
||||||
fullName
|
fullName
|
||||||
role
|
role
|
||||||
|
company {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -723,6 +726,9 @@ export const VerifyLoginCodeDocument = gql`
|
|||||||
email
|
email
|
||||||
fullName
|
fullName
|
||||||
role
|
role
|
||||||
|
company {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ const maxLoginUrl = computed(() => buildBotLoginUrl(maxBotUrl.value));
|
|||||||
|
|
||||||
async function finalizeSession(accessToken: string) {
|
async function finalizeSession(accessToken: string) {
|
||||||
authCookie.value = accessToken;
|
authCookie.value = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigateAfterLogin(user: { company?: { id: string } | null }) {
|
||||||
|
if (!user.company?.id) {
|
||||||
|
await navigateTo('/profile');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await navigateTo('/products');
|
await navigateTo('/products');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +154,7 @@ async function verifyCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await finalizeSession(payload.accessToken);
|
await finalizeSession(payload.accessToken);
|
||||||
|
await navigateAfterLogin(payload.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function consumeLoginToken(loginToken: string) {
|
async function consumeLoginToken(loginToken: string) {
|
||||||
@@ -160,6 +169,7 @@ async function consumeLoginToken(loginToken: string) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await finalizeSession(payload.accessToken);
|
await finalizeSession(payload.accessToken);
|
||||||
|
await navigateAfterLogin(payload.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scheduleAutoRequest() {
|
function scheduleAutoRequest() {
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ mutation ConsumeLoginToken($token: String!) {
|
|||||||
email
|
email
|
||||||
fullName
|
fullName
|
||||||
role
|
role
|
||||||
|
company {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ mutation VerifyLoginCode($input: VerifyLoginCodeInput!) {
|
|||||||
email
|
email
|
||||||
fullName
|
fullName
|
||||||
role
|
role
|
||||||
|
company {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user