Skip to content

Commit

Permalink
V2.0.0 beta.44
Browse files Browse the repository at this point in the history
  • Loading branch information
mateomorris committed Feb 9, 2024
1 parent 041c77b commit dbd25a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
24 changes: 8 additions & 16 deletions src/lib/components/Themes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@
let themes = []
axios
.get('https://primosites.vercel.app/api/primo-landing-page/themes')
.get(
'https://primosites.vercel.app/api/primo-landing-page/themes?sections=ff5c3e56-690b-4220-abe9-9f02a74e1599',
)
.then(({ data }) => {
const themes_section = data.sections.find(
(section) => section._meta.id === 'ff5c3e56-690b-4220-abe9-9f02a74e1599'
)
themes = themes_section.templates.filter(
(template) => template.price === '0' && template.available
)
const [section] = data.sections
themes = section.templates.filter((template) => template.price === '0' && template.available)
})
let selectedTheme = null
async function selectTheme(theme) {
const { data } = await axios.get(
`https://raw.githubusercontent.com/${theme.repo}/main/primo.json`
`https://raw.githubusercontent.com/${theme.repo}/main/primo.json`,
)
const validated = validate_site_structure_v2(data)
selectedTheme = theme.name
Expand All @@ -32,20 +30,14 @@
let active_theme_page = 0
$: active_themes =
themes.length > 0
? themes.slice(active_theme_page * 4, active_theme_page * 4 + 4)
: []
themes.length > 0 ? themes.slice(active_theme_page * 4, active_theme_page * 4 + 4) : []
</script>

<header>
<h2 class="heading">Themes</h2>
{#if themes.length > 0}
<div class="buttons">
<button
on:click={() => active_theme_page--}
type="button"
disabled={active_theme_page === 0}
>
<button on:click={() => active_theme_page--} type="button" disabled={active_theme_page === 0}>
<Icon icon="ic:round-chevron-left" />
</button>
<button
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/[site]/[...page]/+server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export async function GET({ url, params }) {
for (const p of url.searchParams) {
if (options.hasOwnProperty(p[0])) {
options[p[0]] = p[1]
} else {
return json({ error: `${p[0]} isn't a valid query parameter` })
}
}

Expand Down Expand Up @@ -90,8 +92,6 @@ export async function GET({ url, params }) {
},
}

console.log({ sections_data })

const page = {
// @ts-ignore
...page_data['content'][lang],
Expand Down

0 comments on commit dbd25a3

Please sign in to comment.