Skip to content

Commit

Permalink
fix: correctly determine loggedin state for search token (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
geisterfurz007 authored Jan 10, 2024
1 parent 9c3b815 commit 8b06af1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/cms/src/graphql/queries/groupchat-search-token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {type GeneratedTypes} from 'payload';
import {apiKey} from '../../dataseeder/seed-typesense-key';
import {getAuthStateFromRequest} from '../../lib/get-auth-state-from-request';
import {typesenseClient} from '../../lib/typesense';
import {type QueryFactory} from '../../utils/merge-queries';

Expand All @@ -12,11 +13,11 @@ export const groupchatSearchTokenQuery: QueryFactory<string, void> = (
type: new GraphQL.GraphQLNonNull(GraphQL.GraphQLString),
args: {},
resolve: async (_: unknown, __, context) => {
const isAuthenticated = !!context.req.user;
const {isLoggedIn} = await getAuthStateFromRequest(context.req);

const accessiblePlatforms: GroupchatPlatform[] = ['facebook'];

if (isAuthenticated) {
if (isLoggedIn) {
accessiblePlatforms.push('discord', 'signal', 'telegram', 'whatsapp');
}

Expand Down

0 comments on commit 8b06af1

Please sign in to comment.