File tree Expand file tree Collapse file tree 5 files changed +18
-12
lines changed
committees/[committeeKey] Expand file tree Collapse file tree 5 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 11import NextAuth , { type AuthOptions } from 'next-auth'
22import GitHubProvider from 'next-auth/providers/github'
33import { apolloClient } from 'server/apolloClient'
4- import { IS_PROJECT_LEADER_QUERY , IS_MENTOR_QUERY } from 'server/queries/mentorshipQueries'
4+ import {
5+ IsMentorDocument ,
6+ IsProjectLeaderDocument ,
7+ } from 'types/__generated__/mentorshipQueries.generated'
58import { ExtendedProfile , ExtendedSession } from 'types/auth'
69import { IS_GITHUB_AUTH_ENABLED } from 'utils/env.server'
710
811async function checkIfProjectLeader ( login : string ) : Promise < boolean > {
912 try {
1013 const client = await apolloClient
1114 const { data } = await client . query ( {
12- query : IS_PROJECT_LEADER_QUERY ,
15+ query : IsProjectLeaderDocument ,
1316 variables : { login } ,
1417 fetchPolicy : 'no-cache' ,
1518 } )
@@ -23,7 +26,7 @@ async function checkIfMentor(login: string): Promise<boolean> {
2326 try {
2427 const client = await apolloClient
2528 const { data } = await client . query ( {
26- query : IS_MENTOR_QUERY ,
29+ query : IsMentorDocument ,
2730 variables : { login } ,
2831 fetchPolicy : 'no-cache' ,
2932 } )
Original file line number Diff line number Diff line change 11import { Metadata } from 'next'
22import React from 'react'
33import { apolloClient } from 'server/apolloClient'
4- import { GET_CHAPTER_METADATA } from 'server/queries /chapterQueries'
4+ import { GetChapterMetadataDocument } from 'types/__generated__ /chapterQueries.generated '
55import { generateSeoMetadata } from 'utils/metaconfig'
66
77export async function generateMetadata ( {
@@ -11,7 +11,7 @@ export async function generateMetadata({
1111} ) : Promise < Metadata > {
1212 const { chapterKey } = await params
1313 const { data } = await apolloClient . query ( {
14- query : GET_CHAPTER_METADATA ,
14+ query : GetChapterMetadataDocument ,
1515 variables : {
1616 key : chapterKey ,
1717 } ,
Original file line number Diff line number Diff line change 11import { Metadata } from 'next'
22import React from 'react'
33import { apolloClient } from 'server/apolloClient'
4- import { GET_COMMITTEE_METADATA } from 'server/queries /committeeQueries'
4+ import { GetCommitteeMetadataDocument } from 'types/__generated__ /committeeQueries.generated '
55import { generateSeoMetadata } from 'utils/metaconfig'
66
77export async function generateMetadata ( {
@@ -11,7 +11,7 @@ export async function generateMetadata({
1111} ) : Promise < Metadata > {
1212 const { committeeKey } = await params
1313 const { data } = await apolloClient . query ( {
14- query : GET_COMMITTEE_METADATA ,
14+ query : GetCommitteeMetadataDocument ,
1515 variables : {
1616 key : committeeKey ,
1717 } ,
Original file line number Diff line number Diff line change 11import { Metadata } from 'next'
22import React from 'react'
33import { apolloClient } from 'server/apolloClient'
4- import { GET_USER_METADATA , GET_USER_DATA } from 'server/queries/userQueries'
4+ import {
5+ GetUserDataDocument ,
6+ GetUserMetadataDocument ,
7+ } from 'types/__generated__/userQueries.generated'
58import { generateSeoMetadata } from 'utils/metaconfig'
69import { generateProfilePageStructuredData } from 'utils/structuredData'
710import StructuredDataScript from 'components/StructuredDataScript'
@@ -13,7 +16,7 @@ export async function generateMetadata({
1316} ) : Promise < Metadata > {
1417 const { memberKey } = await params
1518 const { data } = await apolloClient . query ( {
16- query : GET_USER_METADATA ,
19+ query : GetUserMetadataDocument ,
1720 variables : {
1821 key : memberKey ,
1922 } ,
@@ -41,7 +44,7 @@ export default async function UserDetailsLayout({
4144 const { memberKey } = await params
4245
4346 const { data } = await apolloClient . query ( {
44- query : GET_USER_DATA ,
47+ query : GetUserDataDocument ,
4548 variables : {
4649 key : memberKey ,
4750 } ,
Original file line number Diff line number Diff line change 11import { useMutation } from '@apollo/client/react'
22import { signOut } from 'next-auth/react'
33import { useState } from 'react'
4- import { LOGOUT_DJANGO_MUTATION } from 'server/queries /authQueries'
4+ import { LogoutDjangoDocument } from 'types/__generated__ /authQueries.generated '
55
66// Handles logout:
77// 1) calls Django logout mutation (invalidates session cookie),
88// 2) signs the user out of NextAuth (clears JWT & redirects),
99// 3) clears Apollo cache so no user data lingers in memory.
1010
1111export const useLogout = ( ) => {
12- const [ logoutUser , { loading, client } ] = useMutation ( LOGOUT_DJANGO_MUTATION )
12+ const [ logoutUser , { loading, client } ] = useMutation ( LogoutDjangoDocument )
1313 const [ isLoggingOut , setIsLoggingOut ] = useState ( false )
1414
1515 const handleLogout = async ( ) => {
You can’t perform that action at this time.
0 commit comments