Skip to content

Commit

Permalink
one file
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-hu committed Nov 21, 2023
1 parent c2db8f1 commit a0713f2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion netlify/functions/load-game/load-game.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/prefer-default-export */
import { Handler } from '@netlify/functions';
import { doc, getDoc } from 'firebase/firestore';
import { db, gamesCollection } from '../../shared/firestore';
import { db, gamesCollection } from '../../shared';

export const handler: Handler = async (event) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion netlify/functions/save-game/save-game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Handler } from '@netlify/functions';
import { humanId } from 'human-id';
import { setDoc, doc } from 'firebase/firestore';
import { db, gamesCollection } from '../../shared/firestore';
import { db, gamesCollection } from '../../shared';

export const handler: Handler = async (event) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions netlify/shared/firestore.ts → netlify/shared.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable import/prefer-default-export */
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
import { isProd } from './env';

const firebaseApp = initializeApp({
apiKey: process.env.FIRESTORE_KEY,
Expand All @@ -16,3 +14,5 @@ const firebaseApp = initializeApp({
export const db = getFirestore(firebaseApp);

export const gamesCollection = () => (isProd() ? 'games' : 'games-dev');

export const isProd = () => process.env.ENV === 'prod';
2 changes: 0 additions & 2 deletions netlify/shared/env.ts

This file was deleted.

0 comments on commit a0713f2

Please sign in to comment.