Skip to content

๐Ÿ” Embed images and download files securely via API requests

License

Notifications You must be signed in to change notification settings

dogchef-be/nuxt-secure-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

nuxt-secure-files

Embed images and download files securely via API requests


Table of contents

Main features

  • Download Base64 files
  • Directive for embedding images (WIP)
  • TypeScript support

Setup

  1. Add nuxt-secure-files dependency to your project:
npm install nuxt-secure-files
  1. Add nuxt-secure-files module to nuxt.config.js:
export default {
  // ...other config options
  modules: ["nuxt-secure-files"];
}
  1. (Optional) TypeScript support. Add nuxt-secure-files to the types section of tsconfig.json:
{
  "compilerOptions": {
    "types": ["nuxt-secure-files"]
  }
}

Usage

  1. Make sure Axios is setup, so the Authorization request header is sent. Example:
const axiosPlugin: Plugin = ({ $axios }): void => {
  $axios.onRequest((config: AxiosRequestConfig): void => {
    config.headers.Authorization = 'Bearer XXXXXXXXXXXXXXXX'
  })
}

export default axiosPlugin
  1. Use $secDownload:
{
  methods: {
    downloadFile() {
        this.$secDownload('/api/file/xx', 'file_xx.pdf');
    }
  }
}

License

See the LICENSE file for license rights and limitations (MIT).