Мы собрали статистику за 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"