Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for generating full static site #315

Closed
wants to merge 5 commits into from

Conversation

josix
Copy link
Collaborator

@josix josix commented Aug 11, 2022

  • build(nuxt-generate): add dynamic routes configuration and update to use asyncData fetching data

Types of changes

  • New feature

Description

  • Update configuration to be able to generate dynamic routes
  • Update to use asycData so that the pages could be full static. (I'm still figuring out the reason; the data only showed up in full static mode in this approach anyway.)

Steps to Test This Pull Request

  1. npm run json-server
  2. npm run generate
  3. npm run start
  4. Check out if all pages works well.

Expected behavior

  • All pages should show up data as usual.

Related Issue

(Not sure if it could fix_ #308)
Fix #339

@josix josix force-pushed the feat/generate-static-site branch 2 times, most recently from 503ff81 to 664e595 Compare August 11, 2022 04:22
@mattwang44
Copy link
Member

CI failed due to no dependency of axios. (we use npm ci so you need to check-in the package-lock.json)

@mattwang44 mattwang44 requested a review from flynnhou August 11, 2022 10:10
@josix josix force-pushed the feat/generate-static-site branch 2 times, most recently from db2806e to 3fc4a62 Compare August 25, 2022 07:59
@josix josix linked an issue Nov 6, 2022 that may be closed by this pull request
@josix josix changed the base branch from main to pycontw-2022 November 18, 2022 18:18
@josix josix self-assigned this Nov 19, 2022
@josix josix marked this pull request as ready for review November 27, 2022 14:57
eventType: params.eventType,
eventId: params.id,
})
const speechData = store.state.speechData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store.state?.speechData

Comment on lines +192 to +193
eventType: params.eventType,
eventId: params.id,
Copy link
Contributor

@yungshenglu yungshenglu Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventType: params?.eventType,
eventId: params?.id,

await store.dispatch('$getSpeechesData', eventType)
const speechesData = store.state.speechesData.map((speech) => ({
...speech,
begin_time: speech.begin_time ? new Date(speech.begin_time) : null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speech?.begin_time

async asyncData({ store, app }) {
await store.dispatch('$getKeynotesData')

const keynotesData = store.state.keynotesData.map((keynote) => ({
Copy link
Contributor

@yungshenglu yungshenglu Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const keynotesData = store.state?.keynotesData.map((keynote) => ({

@@ -120,6 +119,13 @@ export default {
I18nPageWrapper,
Intro,
},
async asyncData({ store }) {
await store.dispatch('$getSponsorsData')
const sponsorsData = store.state.sponsorsData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const sponsorsData = store.state?.sponsorsData

@@ -39,19 +39,24 @@ export default {
JobsCardCollection,
JobsPanel,
},
async asyncData({ store, app }) {
await store.dispatch('$getJobsData')
const jobsData = store.state.jobsData.map((sponsor) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const jobsData = store.state?.jobsData.map((sponsor) => ({

const eventType = params.eventType
if (!['talks', 'tutorials'].includes(eventType)) {
redirect('/')
}
await store.dispatch('$getSpeechesData', eventType)
const speechesData = store.state.speechesData.map((speech) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const speechesData = store.state?.speechesData.map((speech) => ({

`${DEFAULT_BASE_URL}/api/events/speeches/${tutorial.event_type}/${tutorial.id}/`,
config,
)
.then((response) => response.data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.then((response) => response?.data)

@josix
Copy link
Collaborator Author

josix commented Feb 25, 2023

Duplicated with #380

@josix josix closed this Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nuxt build halts the machine 2022 轉換靜態頁
4 participants