Skip to content

Commit

Permalink
Merge pull request #8 from crab85193/develop
Browse files Browse the repository at this point in the history
API URLを直指定して本番環境でのundefined問題を解消
  • Loading branch information
crab85193 authored Dec 18, 2024
2 parents 137b795 + d68ce65 commit 56cd257
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0
with:
envkey_REACT_APP_YUMEMI_API_URL: ${{ secrets.YUMEMI_API_URL }}
envkey_REACT_APP_YUMEMI_API_KEY: ${{ secrets.YUMEMI_API_KEY }}
directory: ./
file_name: .env
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-ph-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- name: Make envfile
uses: SpicyPizza/create-envfile@v2.0
with:
envkey_REACT_APP_YUMEMI_API_URL: ${{ secrets.YUMEMI_API_URL }}
envkey_REACT_APP_YUMEMI_API_KEY: ${{ secrets.YUMEMI_API_KEY }}
directory: ./
file_name: .env
Expand Down
2 changes: 1 addition & 1 deletion src/api/population.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const fetchPopulation = async (
): Promise<PopulationCategory[]> => {
try {
const response = await axios.get<PopulationResponse>(
`${process.env.REACT_APP_YUMEMI_API_URL}/api/v1/population/composition/perYear?prefCode=${prefCode}`,
`https://yumemi-frontend-engineer-codecheck-api.vercel.app/api/v1/population/composition/perYear?prefCode=${prefCode}`,
{
headers: {
"X-API-KEY": process.env.REACT_APP_YUMEMI_API_KEY!,
Expand Down
2 changes: 1 addition & 1 deletion src/api/prefectures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Prefecture } from "../types/prefecture";
export const fetchPrefectures = async (): Promise<Prefecture[]> => {
try {
const response = await axios.get(
`${process.env.REACT_APP_YUMEMI_API_URL}/api/v1/prefectures`,
`https://yumemi-frontend-engineer-codecheck-api.vercel.app/api/v1/prefectures`,
{
headers: { "X-API-KEY": process.env.REACT_APP_YUMEMI_API_KEY },
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/population.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("fetchPopulation", () => {

expect(result).toEqual(mockData);
expect(mockedAxios.get).toHaveBeenCalledWith(
`${process.env.REACT_APP_YUMEMI_API_URL}/api/v1/population/composition/perYear?prefCode=${prefCode}`,
`https://yumemi-frontend-engineer-codecheck-api.vercel.app/api/v1/population/composition/perYear?prefCode=${prefCode}`,
{
headers: {
"X-API-KEY": process.env.REACT_APP_YUMEMI_API_KEY!,
Expand All @@ -48,7 +48,7 @@ describe("fetchPopulation", () => {
"Error fetching population data: Error: API Error"
);
expect(mockedAxios.get).toHaveBeenCalledWith(
`${process.env.REACT_APP_YUMEMI_API_URL}/api/v1/population/composition/perYear?prefCode=${prefCode}`,
`https://yumemi-frontend-engineer-codecheck-api.vercel.app/api/v1/population/composition/perYear?prefCode=${prefCode}`,
{
headers: {
"X-API-KEY": process.env.REACT_APP_YUMEMI_API_KEY!,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/prefectures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("fetchPrefectures", () => {

expect(result).toEqual(mockData);
expect(mockedAxios.get).toHaveBeenCalledWith(
`${process.env.REACT_APP_YUMEMI_API_URL}/api/v1/prefectures`,
`https://yumemi-frontend-engineer-codecheck-api.vercel.app/api/v1/prefectures`,
{
headers: { "X-API-KEY": process.env.REACT_APP_YUMEMI_API_KEY },
}
Expand Down

0 comments on commit 56cd257

Please sign in to comment.