-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow users to once again click on individual loo markers
- Loading branch information
Showing
12 changed files
with
153 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ build | |
|
||
# nextjs | ||
.next | ||
.loos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { getServerPageMinimumViableLooResponse } from './api-client/staticPage'; | ||
|
||
const LOO_CACHE_PATH = path.resolve('.loos'); | ||
|
||
export default async function getStaticPropsAllLoos() { | ||
let cachedData; | ||
|
||
try { | ||
cachedData = JSON.parse(fs.readFileSync(LOO_CACHE_PATH, 'utf8')); | ||
} catch (error) { | ||
console.log('Member cache not initialized'); | ||
} | ||
|
||
if (!cachedData) { | ||
const { dbConnect } = require('./api/db'); | ||
await dbConnect(); | ||
|
||
const res = await getServerPageMinimumViableLooResponse({ | ||
variables: { limit: 1000000 }, | ||
}); | ||
|
||
if (res.props.error || !res.props.data) { | ||
return { | ||
notFound: true, | ||
}; | ||
} | ||
|
||
const data = res.props.apolloState; | ||
|
||
try { | ||
fs.writeFileSync(LOO_CACHE_PATH, JSON.stringify(data), 'utf8'); | ||
console.log('Wrote to loos cache'); | ||
} catch (error) { | ||
console.log('ERROR WRITING LOOS CACHE TO FILE'); | ||
console.log(error); | ||
} | ||
|
||
cachedData = data; | ||
} | ||
|
||
return cachedData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.