diff --git a/docker-compose.yml b/docker-compose.yml index 21472c2..e9e241d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -100,6 +100,9 @@ services: - '6006:6006' volumes: - ./view:/app/next-project + environment: + SSR_API_URI: 'http://go:1323/api' + CSR_API_URI: 'http://localhost:1323' command: sh -c 'npm run dev & npm run storybook' depends_on: - go diff --git a/go_api/main.go b/go_api/main.go index 6f5d107..e10e0e1 100644 --- a/go_api/main.go +++ b/go_api/main.go @@ -2,7 +2,7 @@ package main import ( "net/http" - "os" + // "os" _ "github.com/NUTFes/lottery/go_api/docs" "github.com/NUTFes/lottery/go_api/infrastructure" @@ -38,6 +38,13 @@ func main() { // DB接続 client := infrastructure.ConnectDB() + // cors設定 + arrowOrigins := []string{"http://localhost:3000"} + e.Use(middleware.Logger()) + e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ + AllowOrigins: arrowOrigins, + })) + // 依存の方向:controller -> usecase -> domain <- infrastructure adminInfrastructure := infrastructure.NewAdminInfrastructure(client) eventInfrastructure := infrastructure.NewEventInfrastructure(client) @@ -60,12 +67,12 @@ func main() { // ルーティング(APIが増えると、server.goが肥大化するので、今後別にファイルに分ける) // BasicAuth - e.Use(middleware.BasicAuth(func(username string, password string, c echo.Context) (bool, error) { - if username == os.Getenv("ADMIN_NAME") && password == os.Getenv("ADMIN_PASS") { - return true, nil - } - return false, nil - })) + // e.Use(middleware.BasicAuth(func(username string, password string, c echo.Context) (bool, error) { + // if username == os.Getenv("ADMIN_NAME") && password == os.Getenv("ADMIN_PASS") { + // return true, nil + // } + // return false, nil + // })) // admins e.GET("/admins", adminController.IndexAdmin) diff --git a/view/next.config.js b/view/next.config.js index a843cbe..2be6b2e 100644 --- a/view/next.config.js +++ b/view/next.config.js @@ -1,6 +1,10 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + env: { + SSR_API_URI: process.env.SSR_API_URI, + CSR_API_URI: process.env.CSR_API_URI, + } } module.exports = nextConfig diff --git a/view/src/components/common/Card/EventParticipantCard.stories.tsx b/view/src/components/common/Card/EventParticipantCard.stories.tsx index 733574f..a75d257 100644 --- a/view/src/components/common/Card/EventParticipantCard.stories.tsx +++ b/view/src/components/common/Card/EventParticipantCard.stories.tsx @@ -19,4 +19,4 @@ Default.args = { participantType: 'all', } -Default.storyName = 'Default' +Default.storyName = 'デフォルト' diff --git a/view/src/components/common/Card/EventParticipantCard.tsx b/view/src/components/common/Card/EventParticipantCard.tsx index 5fd4275..21b49f6 100644 --- a/view/src/components/common/Card/EventParticipantCard.tsx +++ b/view/src/components/common/Card/EventParticipantCard.tsx @@ -9,7 +9,7 @@ import CardContent from '@mui/material/CardContent' import Typography from '@mui/material/Typography' import { CardActionArea } from '@mui/material' import { EventParticipantCardProps } from './EventParticipantCard.type' -import { useMemo } from 'react' +import { useState, useEffect, useMemo } from 'react' const EventParticipantCard = (props: EventParticipantCardProps) => { const { participantType, participantParsent, participantCount } = props diff --git a/view/src/components/common/Header/AdminHeader.stories.tsx b/view/src/components/common/Header/AdminHeader.stories.tsx index 9a7a1b7..fa35eb5 100644 --- a/view/src/components/common/Header/AdminHeader.stories.tsx +++ b/view/src/components/common/Header/AdminHeader.stories.tsx @@ -10,4 +10,4 @@ const Template: ComponentStory = (args) => = Template.bind({}) -Default.storyName = 'Default' +Default.storyName = 'デフォルト' diff --git a/view/src/components/layout/MainLayout/index.tsx b/view/src/components/layout/MainLayout/index.tsx new file mode 100644 index 0000000..ed5671f --- /dev/null +++ b/view/src/components/layout/MainLayout/index.tsx @@ -0,0 +1 @@ +export { default } from './MainLayout'; diff --git a/view/src/pages/_app.tsx b/view/src/pages/_app.tsx index 996ca73..a7f9cde 100644 --- a/view/src/pages/_app.tsx +++ b/view/src/pages/_app.tsx @@ -1,5 +1,4 @@ import 'src/styles/globals.css' -import '/src/styles/globals.css' import type { AppProps } from 'next/app' export default function App({ Component, pageProps }: AppProps) {