Fix export from segment config

This commit is contained in:
Max Leiter 2022-12-17 23:15:35 -08:00
parent 3e199cf8d4
commit 5e976bfc0d
3 changed files with 8 additions and 3 deletions

View file

@ -3,13 +3,14 @@
import { startTransition, useEffect, useRef, useState } from "react" import { startTransition, useEffect, useRef, useState } from "react"
import styles from "./auth.module.css" import styles from "./auth.module.css"
import Link from "../../components/link" import Link from "../../components/link"
import { getSession, signIn } from "next-auth/react" import { signIn } from "next-auth/react"
import Input from "@components/input" import Input from "@components/input"
import Button from "@components/button" import Button from "@components/button"
import { GitHub } from "react-feather" import { GitHub } from "react-feather"
import { useToasts } from "@components/toasts" import { useToasts } from "@components/toasts"
import { useRouter, useSearchParams } from "next/navigation" import { useRouter, useSearchParams } from "next/navigation"
import Note from "@components/note" import Note from "@components/note"
const Auth = ({ const Auth = ({
page, page,
requiresServerPassword, requiresServerPassword,

View file

@ -1,7 +1,7 @@
import config from "@lib/config" import config from "@lib/config"
import Auth from "../components" import Auth from "../components"
export function isGithubEnabled() { function isGithubEnabled() {
return config.github_client_id.length && config.github_client_secret.length ? true : false return config.github_client_id.length && config.github_client_secret.length ? true : false
} }

View file

@ -1,11 +1,15 @@
import Auth from "../components" import Auth from "../components"
import { getRequiresPasscode } from "pages/api/auth/requires-passcode" import { getRequiresPasscode } from "pages/api/auth/requires-passcode"
import { isGithubEnabled } from "../signin/page" import config from "@lib/config"
const getPasscode = async () => { const getPasscode = async () => {
return await getRequiresPasscode() return await getRequiresPasscode()
} }
function isGithubEnabled() {
return config.github_client_id.length && config.github_client_secret.length ? true : false
}
export default async function SignUpPage() { export default async function SignUpPage() {
const requiresPasscode = await getPasscode() const requiresPasscode = await getPasscode()
return <Auth page="signup" requiresServerPassword={requiresPasscode} isGithubEnabled={isGithubEnabled()} /> return <Auth page="signup" requiresServerPassword={requiresPasscode} isGithubEnabled={isGithubEnabled()} />