|
1 | 1 | import graphql from '$lib/utilities/api.js' |
2 | 2 | import { error } from '@sveltejs/kit'; |
3 | 3 |
|
4 | | -export const load = async ({ params, fetch, parent }) => { |
5 | | - const { selectedLanguage } = await parent(); |
6 | | - const english = selectedLanguage === 'en'; |
| 4 | +export const load = async ({ params, fetch }) => { |
| 5 | + const spanish = params.lang === 'es'; |
7 | 6 |
|
8 | 7 | const query = ` |
9 | 8 | query getProject($id: Int!) { |
10 | 9 | project(id: $id) { |
11 | 10 | id |
12 | | - name: ${english ? 'nameEn' : 'nameEs'} |
13 | | - description: ${english ? 'descriptionEn' : 'descriptionEs'} |
| 11 | + name: ${spanish ? 'nameEs' : 'nameEn'} |
| 12 | + description: ${spanish ? 'descriptionEs' : 'descriptionEn'} |
14 | 13 | area |
15 | 14 | thumbnail { |
16 | 15 | filename |
17 | 16 | imageUrl |
18 | | - altText: ${english ? 'altTextEs' : 'altTextEs'} |
| 17 | + altText: ${spanish ? 'altTextEs' : 'altTextEn'} |
19 | 18 | } |
20 | 19 | spaces { |
21 | 20 | id |
22 | 21 | name |
23 | 22 | images { |
24 | 23 | filename |
25 | 24 | imageUrl |
26 | | - altText: ${english ? 'altTextEs' : 'altTextEn'} |
27 | | - description: ${english ? 'descriptionEn' : 'descriptionEs'} |
| 25 | + altText: ${spanish ? 'altTextEs' : 'altTextEn'} |
| 26 | + description: ${spanish ? 'descriptionEs' : 'descriptionEn'} |
28 | 27 | descriptionFont |
29 | 28 | bgColor |
30 | 29 | phoneConfig { |
@@ -76,12 +75,12 @@ export const load = async ({ params, fetch, parent }) => { |
76 | 75 |
|
77 | 76 | const projectId = Number(params.ProyectoID); |
78 | 77 |
|
79 | | - if (!Number.isInteger(projectId)) error(404, english ? 'Project not found' : "Proyecto inexistente"); |
| 78 | + if (!Number.isInteger(projectId)) error(404, spanish ? "Proyecto inexistente" : 'Project not found'); |
80 | 79 |
|
81 | 80 | const data = await graphql(query, { id: projectId }, fetch); |
82 | 81 |
|
83 | 82 | const projectData = data?.project; |
84 | | - if (!projectData) error(404, english ? 'Project not found' : "Proyecto inexistente"); |
| 83 | + if (!projectData) error(404, spanish ? "Proyecto inexistente" : 'Project not found'); |
85 | 84 |
|
86 | 85 | const currentProjectIndex: number = data.projects.findIndex((project: { id: number }) => project.id === projectData.id); |
87 | 86 |
|
|
0 commit comments