frontend: add config for endpoints
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
This commit is contained in:
parent
ddc6c64f0f
commit
bfaa1c0014
7 changed files with 19 additions and 7 deletions
|
|
@ -19,6 +19,7 @@ import {
|
|||
import { Card, CardContent } from '@/components/ui/card/index.js'
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert/index.js'
|
||||
import { useAuthStore } from '@/stores/auth.js'
|
||||
import { API_BASE_URL, S3_BUCKET, S3_ENDPOINT } from '@/config.js'
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ const onSubmit = form.handleSubmit(async (values) => {
|
|||
const assets = []
|
||||
for (const file of selectedFiles.value) {
|
||||
console.log('Contact API asset')
|
||||
const response = await fetch('http://localhost:8080/admin/assets', {
|
||||
const response = await fetch(API_BASE_URL + '/admin/assets', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
@ -84,7 +85,7 @@ const onSubmit = form.handleSubmit(async (values) => {
|
|||
mediaUploadFormData.append('file', file.file, responseBody.filename)
|
||||
|
||||
console.log('Envoi image sur s3')
|
||||
const s3Response = await fetch('http://localhost:32795/assets/', {
|
||||
const s3Response = await fetch(`${S3_ENDPOINT}/${S3_BUCKET}/`, {
|
||||
method: 'POST',
|
||||
body: mediaUploadFormData
|
||||
})
|
||||
|
|
@ -100,7 +101,7 @@ const onSubmit = form.handleSubmit(async (values) => {
|
|||
assets.push(responseBody.id)
|
||||
}
|
||||
|
||||
const response = await fetch('http://localhost:8080/admin/posts', {
|
||||
const response = await fetch(API_BASE_URL + '/admin/posts', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue