Skip to content

Commit 1a05f5f

Browse files
committed
Choose random items
1 parent 18aee3b commit 1a05f5f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.vitepress/theme/components/VueJobs.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ onMounted(async () => {
2828
2929
// load data
3030
if (!openings.length) {
31-
openings = await (await fetch(`${base}`)).json()
31+
const items = await (await fetch(`${base}`)).json()
32+
// choose two random items
33+
if (items && items.length) {
34+
openings = items.sort(() => 0.5 - Math.random()).slice(0, 2)
35+
}
3236
}
3337
})
3438
</script>

0 commit comments

Comments
 (0)