solved readfile problem of config
This commit is contained in:
parent
fa9d4f19d4
commit
ba9d9e6abb
3 changed files with 6 additions and 5 deletions
|
|
@ -1,5 +1,4 @@
|
|||
// Config
|
||||
import config from '/resources/config/config.json'
|
||||
|
||||
|
||||
// Modules
|
||||
import createReport from 'docx-templates';
|
||||
|
|
@ -17,9 +16,12 @@ import ObjektkatalogApi from './ObjektkatalogApi';
|
|||
|
||||
export async function fillTemplate(log, objectData) {
|
||||
let buffer;
|
||||
let configJson
|
||||
// Create docx document.
|
||||
if (objectData.httpStatus === 200) {
|
||||
try {
|
||||
let ConfigFile = fs.readFileSync('resources/config/config.json')
|
||||
configJson = JSON.parse(ConfigFile)
|
||||
// Read template.
|
||||
const template = fs.readFileSync('resources/templates/rp-template.docx');
|
||||
// Create report.
|
||||
|
|
@ -43,7 +45,7 @@ export async function fillTemplate(log, objectData) {
|
|||
tip: 'Ist das Template vorhanden?',
|
||||
};
|
||||
}
|
||||
const folderPath = path.join(config.rootDir, objectData.inventarnummer);
|
||||
const folderPath = path.join(configJson.rootDir, objectData.inventarnummer);
|
||||
// Create Folder if necessary.
|
||||
try {
|
||||
const createDir = await mkdir(folderPath, {recursive: true});
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ export default function Settings() {
|
|||
<NavLink className={'nav-icon'} to="/"><ArrowBackIosIcon/></NavLink>
|
||||
</header>
|
||||
<main>
|
||||
<div className={'full red v-distance'}>Die App muss nach Veränderungen neu gestartet werden!</div>
|
||||
<form onSubmit={selectFolderHandler}>
|
||||
<label htmlFor={"output-root"}>
|
||||
Wurzelverzeichnis
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue