Browse Source

fix auth

main
matthew 2 years ago
parent
commit
1694769467
  1. 10
      searching-front/app/blitz-client.ts
  2. 6
      searching-front/services/modules/elastic/index.ts

10
searching-front/app/blitz-client.ts

@ -2,10 +2,10 @@ import { AuthClientPlugin } from "@blitzjs/auth"
import { setupBlitzClient } from "@blitzjs/next" import { setupBlitzClient } from "@blitzjs/next"
import { BlitzRpcPlugin } from "@blitzjs/rpc" import { BlitzRpcPlugin } from "@blitzjs/rpc"
export const authConfig = { // export const authConfig = {
cookiePrefix: "searching-front-cookie-prefix", // cookiePrefix: "searching-front-cookie-prefix",
} // }
//AuthClientPlugin(authConfig)
export const { withBlitz } = setupBlitzClient({ export const { withBlitz } = setupBlitzClient({
plugins: [AuthClientPlugin(authConfig), BlitzRpcPlugin({})], plugins: [BlitzRpcPlugin({})],
}) })

6
searching-front/services/modules/elastic/index.ts

@ -89,13 +89,15 @@ class Elastic {
} }
public initElastic = async () => { public initElastic = async () => {
;[Languages.EN, Languages.RU].forEach(async (lang) => { const promises = [Languages.EN, Languages.RU].map(async (lang) => {
const indexName = getIndexNameByLang(lang) const indexName = getIndexNameByLang(lang)
const alreadyExist = await this.client.indices.exists({ index: indexName }) const alreadyExist = await this.client.indices.exists({ index: indexName })
if (!alreadyExist) { if (!alreadyExist) {
await this.createIndex(lang) return await this.createIndex(lang)
} }
return
}) })
return await Promise.all(promises)
} }
public index = async (params: ElasticIndexParams) => { public index = async (params: ElasticIndexParams) => {

Loading…
Cancel
Save