From 5fd09dbdabf0d45b05e6986a080fb92a6872aaa3 Mon Sep 17 00:00:00 2001 From: Lanskikh Date: Tue, 8 Oct 2024 16:40:43 +0500 Subject: [PATCH] updating api --- .env | 2 +- package.json | 1 + src/app/(admin)/dashboard/blog/layout.tsx | 7 ++ src/app/(admin)/dashboard/blog/page.tsx | 3 + src/app/(admin)/dashboard/layout.tsx | 7 ++ src/app/(admin)/dashboard/page.tsx | 3 + src/app/(admin)/dashboard/projects/layout.tsx | 7 ++ src/app/(admin)/dashboard/projects/page.tsx | 9 ++ src/app/(admin)/layout.tsx | 40 ++++++ src/app/(auth)/layout.tsx | 24 ++-- src/app/(main)/page.tsx | 11 +- .../AddProject/addProject.generated.ts | 58 +++++++++ src/components/AddProject/addProject.gql | 17 +++ src/components/AddProject/index.tsx | 40 ++++++ src/components/Layout/ProjectFormModal.tsx | 114 ++++++++++++++++++ src/components/login/index.tsx | 9 +- src/components/pages/MainPage/Projects.tsx | 9 +- src/components/pages/MainPage/Statistics.tsx | 4 +- src/lib/apolloClient.ts | 21 +++- .../getProjects/getProjects.generated.ts | 60 +++++++++ src/queries/getProjects/getProjects.gql | 14 +++ src/stores/useAuthStore.ts | 15 --- src/utils/logout/logout.generated.ts | 55 +++++++++ src/utils/logout/logout.gql | 10 ++ yarn.lock | 7 ++ 25 files changed, 504 insertions(+), 43 deletions(-) create mode 100644 src/app/(admin)/dashboard/blog/layout.tsx create mode 100644 src/app/(admin)/dashboard/blog/page.tsx create mode 100644 src/app/(admin)/dashboard/layout.tsx create mode 100644 src/app/(admin)/dashboard/page.tsx create mode 100644 src/app/(admin)/dashboard/projects/layout.tsx create mode 100644 src/app/(admin)/dashboard/projects/page.tsx create mode 100644 src/app/(admin)/layout.tsx create mode 100644 src/components/AddProject/addProject.generated.ts create mode 100644 src/components/AddProject/addProject.gql create mode 100644 src/components/AddProject/index.tsx create mode 100644 src/components/Layout/ProjectFormModal.tsx create mode 100644 src/queries/getProjects/getProjects.generated.ts create mode 100644 src/queries/getProjects/getProjects.gql delete mode 100644 src/stores/useAuthStore.ts create mode 100644 src/utils/logout/logout.generated.ts create mode 100644 src/utils/logout/logout.gql diff --git a/.env b/.env index e80df4f2..54bf5c32 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -NEXT_PUBLIC_API=https://graff.estate/api \ No newline at end of file +NEXT_PUBLIC_API=http://localhost:3001/ diff --git a/package.json b/package.json index 115d6294..cdfc15f1 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "date-fns": "^3.6.0", "framer-motion": "^11.3.9", "graphql": "^16.9.0", + "graphql-scalars": "^1.23.0", "ky": "^1.4.0", "libphonenumber-js": "^1.11.7", "next": "14.2.5", diff --git a/src/app/(admin)/dashboard/blog/layout.tsx b/src/app/(admin)/dashboard/blog/layout.tsx new file mode 100644 index 00000000..d6bb8371 --- /dev/null +++ b/src/app/(admin)/dashboard/blog/layout.tsx @@ -0,0 +1,7 @@ +export default function BlogLayout({ + children, +}: { + children: React.ReactNode; +}) { + return
{children}
; +} diff --git a/src/app/(admin)/dashboard/blog/page.tsx b/src/app/(admin)/dashboard/blog/page.tsx new file mode 100644 index 00000000..eea13102 --- /dev/null +++ b/src/app/(admin)/dashboard/blog/page.tsx @@ -0,0 +1,3 @@ +export default function DashboardBlogPage() { + return
; +} diff --git a/src/app/(admin)/dashboard/layout.tsx b/src/app/(admin)/dashboard/layout.tsx new file mode 100644 index 00000000..2edaef2c --- /dev/null +++ b/src/app/(admin)/dashboard/layout.tsx @@ -0,0 +1,7 @@ +export default function DashboardLayout({ + children, +}: { + children: React.ReactNode; +}) { + return
{children}
; +} diff --git a/src/app/(admin)/dashboard/page.tsx b/src/app/(admin)/dashboard/page.tsx new file mode 100644 index 00000000..31245dac --- /dev/null +++ b/src/app/(admin)/dashboard/page.tsx @@ -0,0 +1,3 @@ +export default function DashboardPage() { + return
; +} diff --git a/src/app/(admin)/dashboard/projects/layout.tsx b/src/app/(admin)/dashboard/projects/layout.tsx new file mode 100644 index 00000000..dea07164 --- /dev/null +++ b/src/app/(admin)/dashboard/projects/layout.tsx @@ -0,0 +1,7 @@ +export default function ProjectsLayout({ + children, +}: { + children: React.ReactNode; +}) { + return
{children}
; +} diff --git a/src/app/(admin)/dashboard/projects/page.tsx b/src/app/(admin)/dashboard/projects/page.tsx new file mode 100644 index 00000000..2163a96b --- /dev/null +++ b/src/app/(admin)/dashboard/projects/page.tsx @@ -0,0 +1,9 @@ +import { AddProject } from '@/components/AddProject'; + +export default function DashboardProjectsPage() { + return ( +
+ +
+ ); +} diff --git a/src/app/(admin)/layout.tsx b/src/app/(admin)/layout.tsx new file mode 100644 index 00000000..0568c5a0 --- /dev/null +++ b/src/app/(admin)/layout.tsx @@ -0,0 +1,40 @@ +'use client'; +import { useCheckAuthQuery } from '@/utils/checkAuth/checkAuth.generated'; +import { useLogoutLazyQuery } from '@/utils/logout/logout.generated'; +import { useApolloClient } from '@apollo/client'; +import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; + +export default function AdminLayout({ + children, +}: { + children: React.ReactNode; +}) { + const router = useRouter(); + + const client = useApolloClient(); + + const { data } = useCheckAuthQuery({}); + + const [logout] = useLogoutLazyQuery({ + onCompleted: () => { + client.refetchQueries({ include: ['CheckAuth'] }); + }, + }); + + useEffect(() => { + if ( + data?.checkAuth.__typename !== 'CheckAuthResponse' || + !data.checkAuth.isAuth + ) { + router.replace('/login'); + } + }, [data, router]); + + return ( +
+ + {children} +
+ ); +} diff --git a/src/app/(auth)/layout.tsx b/src/app/(auth)/layout.tsx index b80a8229..2c823260 100644 --- a/src/app/(auth)/layout.tsx +++ b/src/app/(auth)/layout.tsx @@ -1,6 +1,8 @@ -import { useAuthStore } from '@/stores/useAuthStore'; +'use client'; + import { useCheckAuthQuery } from '@/utils/checkAuth/checkAuth.generated'; import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; export default function AuthLayout({ children, @@ -8,14 +10,16 @@ export default function AuthLayout({ children: React.ReactNode; }) { const router = useRouter(); - const { token } = useAuthStore(); - const { data } = useCheckAuthQuery({ - context: { headers: { Authorization: `Bearer ${token}` } }, - }); - if ( - data?.checkAuth.__typename === 'CheckAuthResponse' && - data.checkAuth.isAuth - ) - router.replace('/'); + + const { data } = useCheckAuthQuery(); + + useEffect(() => { + // if ( + // data?.checkAuth.__typename === 'CheckAuthResponse' && + // data.checkAuth.isAuth + // ) + // router.replace('/dashboard'); + }, [data, router]); + return <>{children}; } diff --git a/src/app/(main)/page.tsx b/src/app/(main)/page.tsx index 6f24291a..5c8aca3e 100644 --- a/src/app/(main)/page.tsx +++ b/src/app/(main)/page.tsx @@ -1,19 +1,16 @@ import { AvailablesSlider } from '@/components/pages/MainPage/Availables/AvailablesSlider'; -import { Calculator } from '@/components/pages/MainPage/Calculator/Calculator'; import { Clients } from '@/components/pages/MainPage/Clients'; import { Datamining } from '@/components/pages/MainPage/Datamining'; import { IntegrationsSlider } from '@/components/pages/MainPage/Integrations/IntegrationsSlider'; import { Motivation } from '@/components/pages/MainPage/Motivation'; -import { Projects } from '@/components/pages/MainPage/Projects'; import { Reviews } from '@/components/pages/MainPage/Reviews'; import { Showreel } from '@/components/pages/MainPage/Showreel'; -import { Statistics } from '@/components/pages/MainPage/Statistics'; import { Streaming } from '@/components/pages/MainPage/Streaming'; import { Winners } from '@/components/pages/MainPage/Winners'; import { integrations } from '@/consts/integrations'; import dynamic from 'next/dynamic'; -export default function Home() { +export default function HomePage() { const DynamicEllipse = dynamic( () => import('@/components/Layout/Ellipse').then(m => m.Ellipse), { @@ -26,7 +23,7 @@ export default function Home() { - + {/* */} - + {/* */} - + {/* */} ); diff --git a/src/components/AddProject/addProject.generated.ts b/src/components/AddProject/addProject.generated.ts new file mode 100644 index 00000000..a5722a88 --- /dev/null +++ b/src/components/AddProject/addProject.generated.ts @@ -0,0 +1,58 @@ +import * as Types from '../../generated/graphql'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type AddProjectMutationVariables = Types.Exact<{ + input: Types.CreateProjectInput; +}>; + + +export type AddProjectMutation = { __typename?: 'Mutation', createProject: { __typename?: 'Error', message: string } | { __typename?: 'Project', id: number, name: string, company: string, city: string, image: string, stage: number, releaseDate: any, devices: Array } }; + + +export const AddProjectDocument = gql` + mutation AddProject($input: CreateProjectInput!) { + createProject(input: $input) { + ... on Error { + message + } + ... on Project { + id + name + company + city + image + stage + releaseDate + devices + } + } +} + `; +export type AddProjectMutationFn = Apollo.MutationFunction; + +/** + * __useAddProjectMutation__ + * + * To run a mutation, you first call `useAddProjectMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useAddProjectMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [addProjectMutation, { data, loading, error }] = useAddProjectMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useAddProjectMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(AddProjectDocument, options); + } +export type AddProjectMutationHookResult = ReturnType; +export type AddProjectMutationResult = Apollo.MutationResult; +export type AddProjectMutationOptions = Apollo.BaseMutationOptions; \ No newline at end of file diff --git a/src/components/AddProject/addProject.gql b/src/components/AddProject/addProject.gql new file mode 100644 index 00000000..ac66ca48 --- /dev/null +++ b/src/components/AddProject/addProject.gql @@ -0,0 +1,17 @@ +mutation AddProject($input: CreateProjectInput!) { + createProject(input: $input) { + ... on Error { + message + } + ... on Project { + id + name + company + city + image + stage + releaseDate + devices + } + } +} diff --git a/src/components/AddProject/index.tsx b/src/components/AddProject/index.tsx new file mode 100644 index 00000000..0db48c06 --- /dev/null +++ b/src/components/AddProject/index.tsx @@ -0,0 +1,40 @@ +'use client'; + +import { Device } from '@/types/IProject'; +import { Button } from '@/ui/Button'; +import { useState } from 'react'; +import { useForm } from 'react-hook-form'; +import { ProjectFormModal } from '../Layout/ProjectFormModal'; +import { useAddProjectMutation } from './addProject.generated'; + +export function AddProject() { + const [open, setOpen] = useState(false); + + const [addProject] = useAddProjectMutation(); + + interface IAddProjectFormInput { + name: string; + company: string; + city: string; + image: string; + stage: 1 | 2 | 3 | 4 | 5; + releaseDate: string; + devices: Device[]; + } + + const { register, handleSubmit } = useForm({ + defaultValues: { devices: [], stage: 1 }, + }); + + return ( + <> + + {open && ( + + )} + + ); +} diff --git a/src/components/Layout/ProjectFormModal.tsx b/src/components/Layout/ProjectFormModal.tsx new file mode 100644 index 00000000..f6ea5263 --- /dev/null +++ b/src/components/Layout/ProjectFormModal.tsx @@ -0,0 +1,114 @@ +import { api } from '@/api'; +import { Device } from '@/types/IProject'; +import Image from 'next/image'; +import { ChangeEvent, useState } from 'react'; +import { useForm } from 'react-hook-form'; + +interface IAddProjectFormInput { + name: string; + company: string; + city: string; + image: string; + stage: 1 | 2 | 3 | 4 | 5; + releaseDate: string; + devices: Device[]; +} + +interface IProjectFormModalProps { + action: 'create' | 'edit'; + onSubmit: (data: IAddProjectFormInput) => void; + defaultValues?: IAddProjectFormInput; +} + +export function ProjectFormModal({ onSubmit, action }: IProjectFormModalProps) { + const { register, handleSubmit, setValue } = useForm({ + defaultValues: { devices: [], stage: 1 }, + }); + + const [file, setFile] = useState(); + const [previewFile, setPreviewFile] = useState(); + + function handleChangeFile(e: ChangeEvent) { + if (!e.target.files) return; + + const targetFile = e.target.files[0]; + + setFile(targetFile); + setPreviewFile(URL.createObjectURL(targetFile)); + } + + async function uploadFile() { + if (!file) return; + + const formData = new FormData(); + formData.append('dest', 'projects'); + formData.append('files', file); + + try { + // const { file }: { file: string } = await api + // .post('upload', { body: formData }) + // .json(); + // setProject((prev) => ({ + // ...prev, + // image: file, + // })); + const { files }: { files: string[] } = await api + .post('upload', { body: formData }) + .json(); + setValue('image', files[0]); + console.log(files); + } catch (error) { + if (error instanceof Error) { + alert(`Error: ${error.message}`); + } + } + } + return ( +
+
+
+ + + + + + + + + + + + + {['Stream', 'Touch', 'Mobile', 'VR'].map(device => ( + + ))} +
+ +
+
+ ); +} diff --git a/src/components/login/index.tsx b/src/components/login/index.tsx index 3eee9e87..7be8a024 100644 --- a/src/components/login/index.tsx +++ b/src/components/login/index.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useAuthStore } from '@/stores/useAuthStore'; +import { useApolloClient } from '@apollo/client'; import { SubmitHandler, useForm } from 'react-hook-form'; import { useLoginMutation } from './login.generated'; @@ -11,9 +11,10 @@ interface ILoginFormInput { export function LoginForm() { const [login] = useLoginMutation(); - const { register, handleSubmit } = useForm(); - const { token, setToken } = useAuthStore(); + const client = useApolloClient(); + + const { register, handleSubmit } = useForm(); const onSubmit: SubmitHandler = async ({ password, @@ -23,7 +24,7 @@ export function LoginForm() { variables: { password, username }, onCompleted: data => { if (data?.login.__typename === 'AuthResponse') - setToken(data.login.accessToken); + client.refetchQueries({ include: ['CheckAuth'] }); }, }); diff --git a/src/components/pages/MainPage/Projects.tsx b/src/components/pages/MainPage/Projects.tsx index 85f8f921..43326e2f 100644 --- a/src/components/pages/MainPage/Projects.tsx +++ b/src/components/pages/MainPage/Projects.tsx @@ -1,8 +1,8 @@ 'use client'; -import { api } from '@/api'; import { ArrowMoreIcon } from '@/components/icons/ArrowMoreIcon'; import { ClassNameWrapper } from '@/hocs/ClassNameWrapper'; +import { useGetProjectsQuery } from '@/queries/getProjects/getProjects.generated'; import { IProject } from '@/types/IProject'; import { Button } from '@/ui/Button'; import { Descriptor } from '@/ui/Descriptor'; @@ -17,10 +17,13 @@ export function Projects() { const [sortedProjects, setSortedProjects] = useState>(); + const { data } = useGetProjectsQuery({ variables: { devices: [] } }); + async function getProjects() { + if (!data) return; try { - const projects: IProject[] = await api.get('projects').json(); - setSortedProjects(getSortedProjects(projects)); + // releaseDate Date хз + setSortedProjects(getSortedProjects([])); } catch (error) { if (error instanceof Error) { alert(`Error: ${error.message}`); diff --git a/src/components/pages/MainPage/Statistics.tsx b/src/components/pages/MainPage/Statistics.tsx index 0fb9f973..d4aad4f2 100644 --- a/src/components/pages/MainPage/Statistics.tsx +++ b/src/components/pages/MainPage/Statistics.tsx @@ -4,7 +4,6 @@ import { api } from '@/api'; import { IProject } from '@/types/IProject'; import { Descriptor } from '@/ui/Descriptor'; import { Title } from '@/ui/Title'; -import { getProjectsCount } from '@/utils/getProjectsCount'; import { motion, useInView, useMotionValue, useSpring } from 'framer-motion'; import { Manrope } from 'next/font/google'; import Image from 'next/image'; @@ -45,7 +44,8 @@ export function Statistics() {
Мы собрали статистику за 13 лет работы c застройщиками, - реализовав {getProjectsCount(projects.length)} + реализовав + {/* {getProjectsCount(projects.length)} */}
diff --git a/src/lib/apolloClient.ts b/src/lib/apolloClient.ts index 2dccbdbd..ee8617c0 100644 --- a/src/lib/apolloClient.ts +++ b/src/lib/apolloClient.ts @@ -4,10 +4,29 @@ import { InMemoryCache, SSRMultipartLink, } from '@apollo/experimental-nextjs-app-support'; +import { DateTypeDefinition } from 'graphql-scalars'; export function makeClient() { - const httpLink = new HttpLink({ uri: 'http://localhost:3001/graphql' }); + const httpLink = new HttpLink({ + uri: 'http://localhost:3001/graphql', + credentials: 'include', + }); + return new ApolloClient({ + // typeDefs: { + // definitions: [DateTypeDefinition], + // }, + // resolvers: [ + // { + // Date: DateResolver, + // }, + // ], + typeDefs: [DateTypeDefinition], + resolvers: { + Date: { + __resolveType: () => 'Date', + }, + }, cache: new InMemoryCache(), link: typeof window === 'undefined' diff --git a/src/queries/getProjects/getProjects.generated.ts b/src/queries/getProjects/getProjects.generated.ts new file mode 100644 index 00000000..348ed404 --- /dev/null +++ b/src/queries/getProjects/getProjects.generated.ts @@ -0,0 +1,60 @@ +import * as Types from '../../generated/graphql'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type GetProjectsQueryVariables = Types.Exact<{ + devices: Array | Types.Scalars['String']['input']; +}>; + + +export type GetProjectsQuery = { __typename?: 'Query', projects: Array<{ __typename?: 'Project', id: number, name: string, company: string, city: string, image: string, stage: number, releaseDate: any, devices: Array }> }; + + +export const GetProjectsDocument = gql` + query GetProjects($devices: [String!]!) { + projects(input: {devices: $devices}) { + id + name + company + city + image + stage + releaseDate + devices + } +} + `; + +/** + * __useGetProjectsQuery__ + * + * To run a query within a React component, call `useGetProjectsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetProjectsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetProjectsQuery({ + * variables: { + * devices: // value for 'devices' + * }, + * }); + */ +export function useGetProjectsQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: GetProjectsQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(GetProjectsDocument, options); + } +export function useGetProjectsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(GetProjectsDocument, options); + } +export function useGetProjectsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(GetProjectsDocument, options); + } +export type GetProjectsQueryHookResult = ReturnType; +export type GetProjectsLazyQueryHookResult = ReturnType; +export type GetProjectsSuspenseQueryHookResult = ReturnType; +export type GetProjectsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/src/queries/getProjects/getProjects.gql b/src/queries/getProjects/getProjects.gql new file mode 100644 index 00000000..26dcc8be --- /dev/null +++ b/src/queries/getProjects/getProjects.gql @@ -0,0 +1,14 @@ +scalar Date + +query GetProjects($devices: [String!]!) { + projects(input: { devices: $devices }) { + id + name + company + city + image + stage + releaseDate + devices + } +} diff --git a/src/stores/useAuthStore.ts b/src/stores/useAuthStore.ts deleted file mode 100644 index 2de74932..00000000 --- a/src/stores/useAuthStore.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { create } from 'zustand'; -import { persist } from 'zustand/middleware'; - -export const useAuthStore = create<{ - token: string; - setToken: (token: string) => void; -}>()( - persist( - set => ({ - token: '', - setToken: token => set({ token }), - }), - { name: 'auth' }, - ), -); diff --git a/src/utils/logout/logout.generated.ts b/src/utils/logout/logout.generated.ts new file mode 100644 index 00000000..4f2d0c57 --- /dev/null +++ b/src/utils/logout/logout.generated.ts @@ -0,0 +1,55 @@ +import * as Types from '../../generated/graphql'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type LogoutQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type LogoutQuery = { __typename?: 'Query', logout: { __typename?: 'Error', message: string } | { __typename?: 'LogoutResponse', success: boolean } }; + + +export const LogoutDocument = gql` + query Logout { + logout { + ... on Error { + message + } + ... on LogoutResponse { + success + } + } +} + `; + +/** + * __useLogoutQuery__ + * + * To run a query within a React component, call `useLogoutQuery` and pass it any options that fit your needs. + * When your component renders, `useLogoutQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useLogoutQuery({ + * variables: { + * }, + * }); + */ +export function useLogoutQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(LogoutDocument, options); + } +export function useLogoutLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(LogoutDocument, options); + } +export function useLogoutSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { + const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(LogoutDocument, options); + } +export type LogoutQueryHookResult = ReturnType; +export type LogoutLazyQueryHookResult = ReturnType; +export type LogoutSuspenseQueryHookResult = ReturnType; +export type LogoutQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/src/utils/logout/logout.gql b/src/utils/logout/logout.gql new file mode 100644 index 00000000..242cf647 --- /dev/null +++ b/src/utils/logout/logout.gql @@ -0,0 +1,10 @@ +query Logout { + logout { + ... on Error { + message + } + ... on LogoutResponse { + success + } + } +} diff --git a/yarn.lock b/yarn.lock index 3701c20b..f2e55e51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3173,6 +3173,13 @@ graphql-request@^6.0.0: "@graphql-typed-document-node/core" "^3.2.0" cross-fetch "^3.1.5" +graphql-scalars@^1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/graphql-scalars/-/graphql-scalars-1.23.0.tgz#486785d1a6f9449277054a92afc7e1fb73f459d6" + integrity sha512-YTRNcwitkn8CqYcleKOx9IvedA8JIERn8BRq21nlKgOr4NEcTaWEG0sT+H92eF3ALTFbPgsqfft4cw+MGgv0Gg== + dependencies: + tslib "^2.5.0" + graphql-tag@^2.11.0, graphql-tag@^2.12.6: version "2.12.6" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1"