diff --git a/clientsideConfig.js b/clientsideConfig.js index 3c793c4..21e5a89 100644 --- a/clientsideConfig.js +++ b/clientsideConfig.js @@ -1,8 +1,8 @@ const clientsideConfig = { // later for the server - // url: 'tueitapp.tueit.de', - url: 'localhost', + url: 'tueitapp.tueit.de', + // url: 'localhost', port: 3000, }; -export default clientsideConfig; \ No newline at end of file +export default clientsideConfig; diff --git a/components/server/Asset.vue b/components/server/Asset.vue index a2be70d..ab3abd4 100644 --- a/components/server/Asset.vue +++ b/components/server/Asset.vue @@ -123,36 +123,36 @@ const updateConfigItem = async () => { await Axios.put( `https://${clientsideConfig.url}:${clientsideConfig.port}/api/updateConfigItem`, { - primaryID: item.value.primaryID, - assetName: item.value.assetName, - customerID: item.value.customerID, - customer: item.value.customer, - location: item.value.location, - remoteLocation: item.value.remoteLocation, - type: item.value.type, - description: item.value.description, - notes: item.value.notes, - state: item.value.state, - lastView: item.value.lastView, - user: item.value.user, - hardwareBool: item.value.hardwareBool, - model: item.value.model, - serialnumber: item.value.serialnumber, - CPU: item.value.CPU, - RAM: item.value.RAM, - storageConfiguration: item.value.storageConfiguration, - miscellaneous: item.value.miscellaneous, - softwareBool: item.value.softwareBool, - software: item.value.software, - version: item.value.version, - license: item.value.license, - networkBool: item.value.networkBool, - IPv4: item.value.IPv4, - IPv6: item.value.IPv6, - MAC: item.value.MAC, - subnetmask: item.value.subnetmask, + primaryID: item.value.primaryID, + assetName: item.value.assetName, + customerID: item.value.customerID, + customer: item.value.customer, + location: item.value.location, + remoteLocation: item.value.remoteLocation, + type: item.value.type, + description: item.value.description, + notes: item.value.notes, + state: item.value.state, + lastView: item.value.lastView, + user: item.value.user, + hardwareBool: item.value.hardwareBool, + model: item.value.model, + serialnumber: item.value.serialnumber, + CPU: item.value.CPU, + RAM: item.value.RAM, + storageConfiguration: item.value.storageConfiguration, + miscellaneous: item.value.miscellaneous, + softwareBool: item.value.softwareBool, + software: item.value.software, + version: item.value.version, + license: item.value.license, + networkBool: item.value.networkBool, + IPv4: item.value.IPv4, + IPv6: item.value.IPv6, + MAC: item.value.MAC, + subnetmask: item.value.subnetmask, } - ); + ) await getItemById(); } catch (err) { console.log(err); @@ -379,4 +379,4 @@ export default { .rectangle-lightmode { background-color: #EBEBEB; } - \ No newline at end of file + diff --git a/nuxt.config.ts b/nuxt.config.ts index c261123..aaecfc9 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -8,4 +8,12 @@ export default defineNuxtConfig({ cert: './certs/fullchain.pem' } }, + vite: { + server: { + cors: { + origin: true, + optionsSuccessStatus: 204, + }, + } + } }) diff --git a/server/api/getAllConfigItems.ts b/server/api/getAllConfigItems.ts index 3870135..925c871 100644 --- a/server/api/getAllConfigItems.ts +++ b/server/api/getAllConfigItems.ts @@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => { const headers: Record[1]> = { 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de', 'Access-Control-Allow-Headers': 'authorization, content-type', - 'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE', + 'Access-Control-Allow-Methods': 'OPTIONS,GET,HEAD,PUT,PATCH,POST,DELETE', }; setResponseHeaders(event, headers) diff --git a/server/api/getConfigItem/[id].ts b/server/api/getConfigItem/[id].ts index 7253901..41a66a7 100644 --- a/server/api/getConfigItem/[id].ts +++ b/server/api/getConfigItem/[id].ts @@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => { const headers: Record[1]> = { 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de', 'Access-Control-Allow-Headers': 'authorization, content-type', - 'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE', + 'Access-Control-Allow-Methods': 'OPTIONS,GET,HEAD,PUT,PATCH,POST,DELETE', }; setResponseHeaders(event, headers) diff --git a/server/api/updateConfigItem.ts b/server/api/updateConfigItem.ts index 2f9b49f..65ef5dc 100644 --- a/server/api/updateConfigItem.ts +++ b/server/api/updateConfigItem.ts @@ -3,12 +3,12 @@ import { OutgoingMessage } from 'http'; export default defineEventHandler(async (event) => { - const headers: Record[1]> = { - 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de', - 'Access-Control-Allow-Headers': 'authorization, content-type', - 'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS', - }; - setResponseHeaders(event, headers) +// const headers: Record[1]> = { +// 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de', +// 'Access-Control-Allow-Headers': 'authorization, content-type', +// 'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS', +// }; +// setResponseHeaders(event, headers) console.log(event)