2
0

Revert "fix(docker): 🐛 Runtime public environment"

This reverts commit e03fe9f7d9.
This commit is contained in:
Baptiste Arnaud
2022-06-22 07:21:02 +02:00
parent e03fe9f7d9
commit 3e47b37c2e
54 changed files with 164 additions and 349 deletions

View File

@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react'
import { Text, HStack } from '@chakra-ui/react'
import { SearchableDropdown } from '../../../shared/SearchableDropdown'
import { env, isEmpty } from 'utils'
import { isEmpty } from 'utils'
import getConfig from 'next/config'
type FontSelectorProps = {
activeFont?: string
@ -20,11 +21,12 @@ export const FontSelector = ({
}, [])
const fetchPopularFonts = async () => {
if (isEmpty(env('GOOGLE_API_KEY'))) return []
const {
publicRuntimeConfig: { NEXT_PUBLIC_GOOGLE_API_KEY },
} = getConfig()
if (isEmpty(NEXT_PUBLIC_GOOGLE_API_KEY)) return []
const response = await fetch(
`https://www.googleapis.com/webfonts/v1/webfonts?key=${env(
'GOOGLE_API_KEY'
)}&sort=popularity`
`https://www.googleapis.com/webfonts/v1/webfonts?key=${NEXT_PUBLIC_GOOGLE_API_KEY}&sort=popularity`
)
return (await response.json()).items.map(
(item: { family: string }) => item.family