Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/slugs #97

Merged
merged 4 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 2 additions & 23 deletions error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@
<div class="flex-shrink-0 flex justify-center">
<a href="/" class="inline-flex">
<span class="sr-only">Workflow</span>
<!-- <img class="h-40 w-auto" src="./public/saf_logo.svg" alt="" /> -->
<svg width="200px" height="200px" viewBox="0 0 50 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>SAF SVG - blue</title>
<desc>Created with Sketch.</desc>
<g id="SAF-SVG---blue" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="noun_Shield_2736744" transform="translate(5.200000, 0.000000)" fill="#1a73e8" fill-rule="nonzero">
<path d="M3.38103757,8.21109123 C3.67084079,12.0751342 0,14.1037567 0,14.1037567 C0,14.1037567 2.12522361,18.6440072 2.12522361,26.9516995 C2.12522361,35.2593918 4.54025045,40.9588551 9.27370304,45.2093023 C14.0071556,49.4597496 22.3148479,54 22.3148479,54 C22.3148479,54 30.6225403,49.4597496 35.2593918,45.2093023 C39.9928444,40.9588551 42.5044723,35.2593918 42.5044723,26.9516995 C42.5044723,18.6440072 44.6296959,14.1037567 44.6296959,14.1037567 C44.6296959,14.1037567 40.9588551,12.0751342 41.2486583,8.21109123 C41.2486583,8.21109123 37.3846154,7.82468694 32.3613596,5.98926655 C26.372093,3.76744186 22.3148479,0 22.3148479,0 C22.3148479,0 18.1610018,3.76744186 12.1717352,5.98926655 C7.14847943,7.82468694 3.38103757,8.21109123 3.38103757,8.21109123 Z M22.3148479,51.8747764 C20.0930233,50.5223614 14.1037567,47.0447227 10.529517,43.8568873 C6.08586762,39.7996422 3.96064401,34.3899821 3.96064401,26.9516995 C3.96064401,20.9624329 2.8980322,16.8085868 2.22182469,14.7799642 C3.28443649,13.8139535 4.73345259,12.1717352 5.11985689,9.85330948 C6.76207513,9.46690519 9.56350626,8.88729875 12.8479428,7.72808587 C17.1949911,6.18246869 20.5760286,3.76744186 22.3148479,2.41502683 C24.0536673,3.76744186 27.4347048,6.18246869 31.6851521,7.72808587 C34.9695886,8.88729875 37.7710197,9.46690519 39.4132379,9.85330948 C39.7996422,12.1717352 41.2486583,13.8139535 42.3112701,14.7799642 C41.6350626,16.8085868 40.5724508,20.9624329 40.5724508,26.9516995 C40.5724508,34.3899821 38.5438283,39.7996422 34.0035778,43.8568873 C30.4293381,47.0447227 24.5366726,50.5223614 22.3148479,51.8747764 Z M22.3148479,50.5223614 C24.8264758,49.0733453 30.0429338,45.8855098 33.2307692,42.9874776 C37.4812165,39.1234347 39.509839,34.1001789 39.509839,26.9516995 C39.509839,21.4454383 40.3792487,17.3881932 41.0554562,15.1663685 C40.0894454,14.1037567 38.9302326,12.6547406 38.4472272,10.7227191 C36.7084079,10.4329159 34.19678,9.85330948 31.3953488,8.79069767 C27.3381038,7.34168157 24.1502683,5.21645796 22.3148479,3.86404293 L22.3148479,3.86404293 L22.3148479,50.5223614 C22.3148479,50.5223614 22.3148479,50.5223614 22.3148479,50.5223614 L22.3148479,50.5223614 Z" id="Shape"></path>
</g>
<g id="Group" transform="translate(14.500000, 14.000000)" fill-rule="nonzero">
<g id="noun_Gear_31895" fill="#1a73e8">
<path d="M13,0 L11.375,0 L10.7894414,3.51025391 C9.73573047,3.75623828 8.74864453,4.17360937 7.85525,4.72900391 L4.95594531,2.65966797 L2.65809375,4.95751953 L4.72900391,7.85525 C4.17198437,8.74712109 3.75623828,9.73415625 3.51182812,10.7894414 L0,11.375 L0,14.625 L3.51182812,15.2105586 C3.75623828,16.2658437 4.17198437,17.2513555 4.72900391,18.14475 L2.65809375,21.0440547 L4.95594531,23.3419063 L7.85682422,21.2709961 C8.74869531,21.8280156 9.73573047,22.2437617 10.7894414,22.4881719 L11.375,26 L13,26 L13,0 Z M13,19.5 C9.410375,19.5 6.5,16.5895742 6.5,13 C6.5,9.41042578 9.41042578,6.5 13,6.5" id="Shape"></path>
</g>
<g id="noun_Gear_31895" transform="translate(10.000000, 0.000000)" fill="#FFFFFF">
<path d="M16,14.625 L16,11.375 L12.4881719,10.7894414 C12.2437617,9.73415625 11.8280156,8.74864453 11.2709961,7.85525 L13.3419063,4.95751953 L11.0440547,2.65966797 L8.14475,4.72900391 C7.25130469,4.17355859 6.26584375,3.75623828 5.21055859,3.51025391 L4.625,0 L3,0 L3,26 L4.625,26 L5.21055859,22.4881719 C6.26426953,22.2437617 7.25135547,21.8280156 8.14475,21.2709961 L11.0440547,23.3419063 L13.3419063,21.0440547 L11.2709961,18.14475 C11.8280156,17.2513047 12.2437617,16.2642695 12.4881719,15.2105586 L16,14.625 Z M3,6.5 C6.58957422,6.5 9.5,9.41042578 9.5,13 C9.5,16.5895742 6.589625,19.5 3,19.5 L3,19.5" id="Shape"></path>
</g>
</g>
</g>
</svg>
<img class="h-40 sm:h-56 w-auto" src="./assets/safLogo.svg" alt="SAF Logo" />
</a>
</div>
<div class="py-16">
Expand All @@ -38,11 +21,7 @@
</main>
<footer class="flex-shrink-0 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8">
<nav class="flex justify-center space-x-4">
<a href="#" class="text-sm font-medium text-gray-500 hover:text-gray-600">Contact Support</a>
<span class="inline-block border-l border-gray-300" aria-hidden="true" />
<a href="#" class="text-sm font-medium text-gray-500 hover:text-gray-600">Status</a>
<span class="inline-block border-l border-gray-300" aria-hidden="true" />
<a href="#" class="text-sm font-medium text-gray-500 hover:text-gray-600">Twitter</a>
<a href="mailto:saf@groups.mitre.org" class="text-sm font-medium text-gray-500 hover:text-gray-600">Contact Support</a>
</nav>
</footer>
</div>
Expand Down
7 changes: 6 additions & 1 deletion pages/blog/[author].vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const route = useRoute()
const getBlogData = async () => {
posts.value = await useAsyncData('getBlogDataFromAuthor', () => GqlGetBlogDataFromAuthor({ author: route.query.name }))
.then(({ data }) => {
if(!data._value || !data._value.blogPosts.data)
return navigateTo('/blog')
return data._value.blogPosts.data.map((post) => ({
title: post.attributes.title,
description: post.attributes.description,
Expand All @@ -131,6 +133,8 @@ const getBlogData = async () => {
const getBlogAuthor = async () => {
authorObjs.value = await useAsyncData('getBlogAuthor', () => GqlGetBlogAuthor({ author: route.query.name }))
.then(({ data }) => {
if(!data._value || !data._value.usersPermissionsUsers.data[0])
return navigateTo('/blog')
let socialMedia = data._value.usersPermissionsUsers.data[0].attributes.SocialMedia
for (let i = 0; i < socialMedia.length; i++) {
switch (socialMedia[i].__typename) {
Expand Down Expand Up @@ -180,7 +184,8 @@ onMounted(async () => {
await nextTick(async () => {
await getBlogData()
await getBlogAuthor()
author.value = authorObjs.value[0]
if(authorObjs.value != undefined)
author.value = authorObjs.value[0]
isLoaded.value = true
});
});
Expand Down
2 changes: 2 additions & 0 deletions pages/blog/[date]/[title].vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const route = useRoute()
const getBlogPost = async () => {
await useAsyncData('getBlogDataFromID', () => GqlGetBlogDataFromID({ id: route.query.id }))
.then(({ data }) => {
if(!data._value || !data._value.blogPost.data)
return navigateTo('/blog')
postData.value = data._value.blogPost.data.attributes
renderedContent.value = marked(postData.value.content)
postAuthor.value = postData.value.users_permissions_user.data.attributes.name
Expand Down
3 changes: 3 additions & 0 deletions pages/docs/[section].vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export default {
async getData() {
this.docData = await useAsyncData('getDocumentation', () => GqlGetDocumentation({ href: this.$route.params.section }))
.then(({ data }) => {
if(!data._value || !data._value.currentDoc.data[0])
return navigateTo('/docs')

let content = data._value.currentDoc.data[0].attributes.subsections[0].content
this.currentSubsection = data._value.currentDoc.data[0].attributes.subsections[0].title
this.currentSectionTitle = data._value.currentDoc.data[0].attributes.section_title
Expand Down
3 changes: 3 additions & 0 deletions pages/faq/[question].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const answer = ref("")
const getFAQs = async () => {
faq.value = await useAsyncData('getFaqByQuestionNumber', () => GqlGetFaqByQuestionNumber({ number: parseInt(route.params.question) }), { initialCache: false })
.then(({ data }) => {
if(!data._value || !data._value.faqs.data[0])
return navigateTo('/faq')

var date = new Date(data._value.faqs.data[0].attributes.updatedAt)
answer.value = data._value.faqs.data[0].attributes.answer
return {
Expand Down
2 changes: 2 additions & 0 deletions pages/framework/guidance/[guidance].vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default {
async getGuidance() {
this.guidance = await useAsyncData('getGuidanceDataFromID', () => GqlGetGuidanceDataFromID({ id: this.$route.query.id }), { initialCache: false })
.then(({ data }) => {
if(!data._value || !data._value.guidance.data)
return navigateTo('/guidance')
console.log(data)
const guidance = data._value.guidance.data
return {
Expand Down