Fix: caching now works again
This commit is contained in:
parent
5ff60ee8c5
commit
784b4fbaf8
|
@ -33,10 +33,13 @@ const server = new ApolloServer({
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
responseCachePlugin({
|
responseCachePlugin({
|
||||||
sessionId: requestContext =>
|
sessionId: requestContext => {
|
||||||
requestContext.request.http.headers.get('Authorization') ||
|
return (
|
||||||
requestContext.request.http.headers.get('authorization') ||
|
requestContext.request.http.headers.get('authorization') ||
|
||||||
null
|
requestContext.request.http.headers.get('Authorization') ||
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,8 +5,7 @@ const typeDefs = gql`
|
||||||
"Returns only a few fields of User"
|
"Returns only a few fields of User"
|
||||||
basicUser(sAMAccountName: String!): User! @cacheControl(maxAge: 350)
|
basicUser(sAMAccountName: String!): User! @cacheControl(maxAge: 350)
|
||||||
|
|
||||||
me: User! @auth
|
me: User! @auth @cacheControl(maxAge: 30, scope: PRIVATE)
|
||||||
"@cacheControl(maxAge: 30, scope: PRIVATE)"
|
|
||||||
users(
|
users(
|
||||||
where: UserWhereInput!
|
where: UserWhereInput!
|
||||||
limit: Int = 15
|
limit: Int = 15
|
||||||
|
@ -21,7 +20,7 @@ const typeDefs = gql`
|
||||||
@auth(roles: ["servant"])
|
@auth(roles: ["servant"])
|
||||||
@cacheControl(maxAge: 350)
|
@cacheControl(maxAge: 350)
|
||||||
|
|
||||||
stats: Stats!
|
stats: Stats! @cacheControl(maxAge: 30)
|
||||||
|
|
||||||
userPresence(search: String = ""): [UserPresence!] @auth(roles: ["watcher"])
|
userPresence(search: String = ""): [UserPresence!] @auth(roles: ["watcher"])
|
||||||
|
|
||||||
|
@ -29,11 +28,17 @@ const typeDefs = gql`
|
||||||
search: String = ""
|
search: String = ""
|
||||||
identifiedOnly: Boolean = false
|
identifiedOnly: Boolean = false
|
||||||
nonIdentifiedOnly: Boolean = false
|
nonIdentifiedOnly: Boolean = false
|
||||||
): [WifiDevice]! @auth(roles: ["superAdmin"])
|
): [WifiDevice]!
|
||||||
|
@cacheControl(maxAge: 10, scope: PRIVATE)
|
||||||
|
@auth(roles: ["superAdmin"])
|
||||||
|
|
||||||
wifiUsers: [User]! @auth(roles: ["superAdmin"])
|
wifiUsers: [User]!
|
||||||
|
@auth(roles: ["superAdmin"])
|
||||||
|
@cacheControl(maxAge: 10, scope: PRIVATE)
|
||||||
|
|
||||||
logs: [Log]! @auth(roles: ["superAdmin"])
|
logs: [Log]!
|
||||||
|
@auth(roles: ["superAdmin"])
|
||||||
|
@cacheControl(maxAge: 5, scope: PRIVATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
|
|
@ -28,7 +28,7 @@ const defaultOptions = {
|
||||||
persisting: false,
|
persisting: false,
|
||||||
// Use websockets for everything (no HTTP)
|
// Use websockets for everything (no HTTP)
|
||||||
// You need to pass a `wsEndpoint` for this to work
|
// You need to pass a `wsEndpoint` for this to work
|
||||||
websocketsOnly: true,
|
websocketsOnly: false, // true não funciona com a cache do servidor!
|
||||||
// Is being rendered on the server?
|
// Is being rendered on the server?
|
||||||
ssr: false
|
ssr: false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user