Skip to content

Commit 15ccfe3

Browse files
authored
Merge pull request #231 from mapswipe/fix/use-firebaseid-for-projects
fix: use firebaseId for projects in project page
2 parents 262a607 + 7693a6e commit 15ccfe3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

scripts/fetchData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ const query = gql`
133133
fileSize
134134
}
135135
name
136+
firebaseId
136137
image {
137138
id
138139
file {

src/pages/[locale]/data/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const getStaticProps: GetStaticProps = async (context) => {
118118
id: feature.id ?? '',
119119
projectType: feature.projectType,
120120
name: feature.name,
121+
firebaseId: feature.firebaseId,
121122
status: feature.status ?? null,
122123
region: feature.region ?? null,
123124
requestingOrganizationId: feature.requestingOrganization?.id ?? null,
@@ -812,7 +813,7 @@ function Data(props: Props) {
812813
<Link
813814
className={styles.cardLink}
814815
key={project.id}
815-
href={`/[locale]/projects/${project.id}`}
816+
href={`/[locale]/projects/${project.firebaseId}`}
816817
>
817818
<Card
818819
className={styles.project}

src/pages/[locale]/projects/[id].tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function getProjectData(id: string) {
5656
const projects = (
5757
data as AllDataQuery
5858
)?.publicProjects?.results as unknown as PublicProjects;
59-
return projects?.find((item) => String(item.id) === id);
59+
return projects?.find((item) => String(item.firebaseId) === id);
6060
}
6161

6262
const X_AXIS_HEIGHT = 20;
@@ -862,9 +862,9 @@ export const getStaticPaths: GetStaticPaths = async () => {
862862
const projects = await getAllProjects() ?? [];
863863

864864
const pathsWithParams = projects.flatMap(
865-
(project: { id: string }) => i18nextConfig.i18n.locales.map((lng: string) => ({
865+
(project: { firebaseId: string }) => i18nextConfig.i18n.locales.map((lng: string) => ({
866866
params: {
867-
id: project.id.toString(),
867+
id: project.firebaseId.toString(),
868868
locale: lng,
869869
},
870870
})),

0 commit comments

Comments
 (0)