Skip to content

Instantly share code, notes, and snippets.

@Akhigbe-E
Created February 3, 2021 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akhigbe-E/8d3daa67be1e955451d8a6f8e3023c4c to your computer and use it in GitHub Desktop.
Save Akhigbe-E/8d3daa67be1e955451d8a6f8e3023c4c to your computer and use it in GitHub Desktop.
<template>
<div class="grid gap-x-12 gap-y-20 grid-cols-1 sm:grid-cols-3">
<job-card-list-item
v-for="job in jobs"
:key="job.id"
:name="job.companyName"
:title="job.title"
:jobType="job.jobType"
:location="job.location"
:logo="job.companyLogo"
/>
</div>
</template>
<script>
export default {
data: () => ({
jobs: [],
}),
async fetch() {
this.jobs = await fetch(
'https://github-jobs.glitch.me/positions.json?page=1'
)
.then((res) => res.json())
.then((data) => data.slice(0, 9).map((job) => new Jobs(job)))
console.log(this.jobs)
},
}
class Jobs {
constructor({
id,
type,
created_at,
company,
company_url,
company_logo,
location,
title,
}) {
this.id = id
;(this.jobType = type), (this.companyName = company)
this.location = location
this.title = title
this.createdAt = created_at
this.companyUrl = company_url
this.companyLogo = company_logo
}
}
</script>
<style></style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment