-
Notifications
You must be signed in to change notification settings - Fork 1
/
apollo-client.js
154 lines (146 loc) · 3.29 KB
/
apollo-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import { ApolloClient, gql, InMemoryCache, HttpLink } from "@apollo/client"
import { API_URL } from "./src/constants/constants"
import fetch from "cross-fetch"
export const client = new ApolloClient({
cache: new InMemoryCache(),
headers: { "content-type": "application/json" },
link: new HttpLink({ uri: `${API_URL}/graphql?nocache`, fetch }),
})
export const QUESTIONNAIRE_EPDS = gql`
query QuestionnaireEpds {
questionnaireEpds {
libelle
ordre
locale
reponse_1_libelle
reponse_1_points
reponse_2_libelle
reponse_2_points
reponse_3_libelle
reponse_3_points
reponse_4_libelle
reponse_4_points
}
}
`
export const QUESTIONNAIRE_EPDS_TRADUCTION = gql`
query QuestionnaireEpdsTraductions($locale: String) {
questionnaireEpdsTraductions(where: { langue: { identifiant: $locale } }) {
libelle
ordre
langue {
identifiant
}
reponse_1_libelle
reponse_1_points
reponse_2_libelle
reponse_2_points
reponse_3_libelle
reponse_3_points
reponse_4_libelle
reponse_4_points
}
}
`
export const LABELS_EPDS_TRADUCTION = gql`
query LabelsEpdsTraductions($locale: String) {
labelsEpdsTraductions(where: { langue: { identifiant: $locale } }) {
langue {
identifiant
}
labels {
label
texte
}
}
}
`
export const GET_LOCALES = gql`
query Locales {
locales {
id
identifiant
libelle_francais
libelle_langue
drapeau {
url
}
sens_lecture_droite_vers_gauche
}
}
`
export const EPDS_ADD_RESPONSE = gql`
mutation (
$genre: ENUM_REPONSESEPDS_GENRE!
$compteur: Int!
$score: Int!
$source: ENUM_REPONSESEPDS_SOURCE!
$reponseNum1: Int!
$reponseNum2: Int!
$reponseNum3: Int!
$reponseNum4: Int!
$reponseNum5: Int!
$reponseNum6: Int!
$reponseNum7: Int!
$reponseNum8: Int!
$reponseNum9: Int!
$reponseNum10: Int!
$langue: ID
) {
createReponsesEpd(
input: {
data: {
genre: $genre
compteur: $compteur
score: $score
source: $source
reponse_1: $reponseNum1
reponse_2: $reponseNum2
reponse_3: $reponseNum3
reponse_4: $reponseNum4
reponse_5: $reponseNum5
reponse_6: $reponseNum6
reponse_7: $reponseNum7
reponse_8: $reponseNum8
reponse_9: $reponseNum9
reponse_10: $reponseNum10
langue: $langue
}
}
) {
reponsesEpd {
id
created_at
}
}
}
`
export const EPDS_PARTAGE_INFORMATION = gql`
mutation (
$email: String
$email_pro: String!
$email_pro_secondaire: String
$telephone: String
$prenom: String
$nom: String
$score: String
$detail_questions: [String]
$detail_score: [String]
$detail_reponses: [String]
$id_reponses: String
) {
epdsPartage(
email: $email
email_pro: $email_pro
email_pro_secondaire: $email_pro_secondaire
telephone: $telephone
prenom: $prenom
nom: $nom
score: $score
detail_questions: $detail_questions
detail_score: $detail_score
detail_reponses: $detail_reponses
id_reponses: $id_reponses
)
}
`