-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from ConductionNL/feature/CONNECTOR-172/expor…
…t-of-json-files feature/CONNECTOR-172/export-of-json-files
- Loading branch information
Showing
33 changed files
with
276 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# OpenConector | ||
|
||
Provides gateway and service bus functionality like mapping, translation and synchronisation of data | ||
|
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
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
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,49 @@ | ||
import { defineStore } from 'pinia' | ||
|
||
export const useImportExportStore = defineStore( | ||
'importExport', { | ||
state: () => ({ | ||
exportSource: '', | ||
exportSourceResults: '', | ||
exportSourceError: '', | ||
}), | ||
actions: { | ||
setExportSource(exportSource) { | ||
this.exportSource = exportSource | ||
console.info('Active exportSource set to ' + exportSource) | ||
}, | ||
async exportFile(id, type) { | ||
const apiEndpoint = `/index.php/apps/openconnector/api/export/${type}/${id}` | ||
|
||
if (!id) { | ||
throw Error('Passed id is falsy') | ||
} | ||
const response = await fetch( | ||
apiEndpoint, | ||
{ | ||
method: 'GET', | ||
headers: { | ||
Accept: 'application/json', | ||
}, | ||
}, | ||
) | ||
const filename = response.headers.get('Content-Disposition').split('filename=')[1].replace(/['"]/g, '') | ||
|
||
const blob = await response.blob() | ||
|
||
const download = () => { | ||
const url = window.URL.createObjectURL(new Blob([blob])) | ||
const link = document.createElement('a') | ||
link.href = url | ||
|
||
link.setAttribute('download', `${filename}`) | ||
document.body.appendChild(link) | ||
link.click() | ||
} | ||
|
||
return { response, blob, download } | ||
}, | ||
|
||
}, | ||
}, | ||
) |
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
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
Oops, something went wrong.