-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<img :src="src" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import fetchAttachmentDataUri from "@/helpers/fetchAttachmentDataUri"; | ||
import { prop, Vue } from "vue-class-component"; | ||
import { Watch } from "vue-property-decorator"; | ||
class Props { | ||
url = prop<string>({ required: true }); | ||
stack = prop<string>({ required: true }); | ||
} | ||
export default class EditLink extends Vue.with(Props) { | ||
src: string = ""; | ||
@Watch("url", { immediate: true }) | ||
async fetchUrl() { | ||
this.src = await fetchAttachmentDataUri(this.url, this.stack); | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="postcss" scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { Attachment } from "@/api/models/types"; | ||
import { useStore } from "@/store"; | ||
|
||
export default async function fetchAttachmentDataUri(url: Attachment["url"], stack: string) { | ||
const store = useStore(); | ||
const result = await fetch(url.replace("{stack}", stack), { | ||
headers: { | ||
authorization: `JWT ${store.getters["accessToken"]}`, | ||
}, | ||
}); | ||
return URL.createObjectURL(await result.blob()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters