fix: Create a client config function that is retrieved when app is loading (#496)
* fix: Create a client config function that is retrieved when app is loaded * update index.tsx * fixed linter issues
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Args, Mutation, Resolver } from '@nestjs/graphql';
|
||||
import { AuthTokens } from './dto/token.entity';
|
||||
import { Args, Mutation, Resolver, Query} from '@nestjs/graphql';
|
||||
import { AuthTokens, ClientConfig} from './dto/token.entity';
|
||||
import { TokenService } from './services/token.service';
|
||||
import { RefreshTokenInput } from './dto/refresh-token.input';
|
||||
import { BadRequestException } from '@nestjs/common';
|
||||
@ -61,4 +61,17 @@ export class AuthResolver {
|
||||
|
||||
return { tokens: tokens };
|
||||
}
|
||||
}
|
||||
|
||||
@Query(() => ClientConfig)
|
||||
async clientConfig(): Promise<ClientConfig> {
|
||||
const displayGoogleLogin = process.env.AUTH_GOOGLE_CLIENT_ID !== undefined;
|
||||
const prefillLoginWithSeed = process.env.NODE_ENV === 'development';
|
||||
|
||||
const clientConfig: ClientConfig = {
|
||||
display_google_login: displayGoogleLogin,
|
||||
prefill_login_with_seed: prefillLoginWithSeed,
|
||||
};
|
||||
|
||||
return Promise.resolve(clientConfig);
|
||||
}
|
||||
}
|
||||
@ -23,3 +23,12 @@ export class AuthTokens {
|
||||
@Field(() => AuthTokenPair)
|
||||
tokens: AuthTokenPair;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class ClientConfig {
|
||||
@Field(() => Boolean)
|
||||
display_google_login: boolean;
|
||||
|
||||
@Field(() => Boolean)
|
||||
prefill_login_with_seed: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user