Add .env api url

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2025-11-29 01:17:43 +01:00
parent 624e8edbe4
commit 3816d3a296
6 changed files with 7 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
VITE_API_URL=
+2
View File
@@ -25,3 +25,5 @@ dist-ssr
*storybook.log *storybook.log
storybook-static storybook-static
.env
+1 -1
View File
@@ -1,6 +1,6 @@
export default async function getUser() { export default async function getUser() {
try { try {
const res = await fetch('http://localhost:8000/api/me', { const res = await fetch(`http://${import.meta.env.VITE_API_URL}/api/users/me`, {
method: 'GET', method: 'GET',
credentials: 'include', credentials: 'include',
headers: { headers: {
+1 -1
View File
@@ -1,5 +1,5 @@
export default async function getXSRFToken() { export default async function getXSRFToken() {
const response = await fetch('http://localhost:8000/sanctum/csrf-cookie', { const response = await fetch(`http://${import.meta.env.VITE_API_URL}/sanctum/csrf-cookie`, {
method: 'GET', method: 'GET',
credentials: 'include' credentials: 'include'
}); });
+1 -1
View File
@@ -4,7 +4,7 @@ export default async function login(email, password) {
const csrfToken = await getXSRFToken(); const csrfToken = await getXSRFToken();
try { try {
const response = await fetch('http://localhost:8000/api/users/login', { const response = await fetch(`http://${import.meta.env.VITE_API_URL}/api/users/login`, {
method: 'POST', method: 'POST',
credentials: 'include', credentials: 'include',
headers: { headers: {
+1 -1
View File
@@ -4,7 +4,7 @@ export default async function register(email, password, name, lastname) {
const csrfToken = await getXSRFToken(); const csrfToken = await getXSRFToken();
try { try {
const response = await fetch('http://localhost:8000/api/users/register', { const response = await fetch(`http://${import.meta.env.VITE_API_URL}/api/users/register`, {
method: 'POST', method: 'POST',
credentials: 'include', credentials: 'include',
headers: { headers: {