Corrigida as rotas
This commit is contained in:
		@@ -96,7 +96,7 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/auth/register', {
 | 
					            const response = await fetch('/api/auth/register', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -332,7 +332,7 @@
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/user/profile?user_id=${user.id}`);
 | 
					            const response = await fetch(`/api/user/profile?user_id=${user.id}`);
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
                const data = await response.json();
 | 
					                const data = await response.json();
 | 
				
			||||||
                userProfile.value = data.user;
 | 
					                userProfile.value = data.user;
 | 
				
			||||||
@@ -351,7 +351,7 @@
 | 
				
			|||||||
        loadingCategories.value = true;
 | 
					        loadingCategories.value = true;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/categories?user_id=${user.id}`);
 | 
					            const response = await fetch(`/api/categories?user_id=${user.id}`);
 | 
				
			||||||
            const data = await response.json();
 | 
					            const data = await response.json();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
@@ -371,7 +371,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/user/profile', {
 | 
					            const response = await fetch('/api/user/profile', {
 | 
				
			||||||
                method: 'PUT',
 | 
					                method: 'PUT',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
@@ -422,7 +422,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/user/change-password', {
 | 
					            const response = await fetch('/api/user/change-password', {
 | 
				
			||||||
                method: 'PUT',
 | 
					                method: 'PUT',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
@@ -460,7 +460,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/categories', {
 | 
					            const response = await fetch('/api/categories', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@
 | 
				
			|||||||
        error.value = '';
 | 
					        error.value = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/auth/login', {
 | 
					            const response = await fetch('/api/auth/login', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -303,7 +303,7 @@
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/transactions?user_id=${user.id}`);
 | 
					            const response = await fetch(`/api/transactions?user_id=${user.id}`);
 | 
				
			||||||
            const data = await response.json();
 | 
					            const data = await response.json();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
@@ -336,7 +336,7 @@
 | 
				
			|||||||
    const loadCategories = async () => {
 | 
					    const loadCategories = async () => {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/categories?user_id=${user.id}`);
 | 
					            const response = await fetch(`/api/categories?user_id=${user.id}`);
 | 
				
			||||||
            const data = await response.json();
 | 
					            const data = await response.json();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
@@ -382,7 +382,7 @@
 | 
				
			|||||||
                date: newTransaction.value.date
 | 
					                date: newTransaction.value.date
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const response = await fetch('http://localhost:5000/api/transactions', {
 | 
					            const response = await fetch('/api/transactions', {
 | 
				
			||||||
                method: 'POST',
 | 
					                method: 'POST',
 | 
				
			||||||
                headers: {
 | 
					                headers: {
 | 
				
			||||||
                    'Content-Type': 'application/json',
 | 
					                    'Content-Type': 'application/json',
 | 
				
			||||||
@@ -414,7 +414,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/transactions/${transactionId}?user_id=${user.id}`, {
 | 
					            const response = await fetch(`/api/transactions/${transactionId}?user_id=${user.id}`, {
 | 
				
			||||||
                method: 'DELETE'
 | 
					                method: 'DELETE'
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,7 +144,7 @@
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/dashboard/summary?user_id=${user.id}`);
 | 
					            const response = await fetch(`/api/dashboard/summary?user_id=${user.id}`);
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
                const data = await response.json();
 | 
					                const data = await response.json();
 | 
				
			||||||
                summary.value = data;
 | 
					                summary.value = data;
 | 
				
			||||||
@@ -161,7 +161,7 @@
 | 
				
			|||||||
        chartType.value = type;
 | 
					        chartType.value = type;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const user = JSON.parse(localStorage.getItem('user'));
 | 
					            const user = JSON.parse(localStorage.getItem('user'));
 | 
				
			||||||
            const response = await fetch(`http://localhost:5000/api/dashboard/chart?user_id=${user.id}&type=${type}`);
 | 
					            const response = await fetch(`/api/dashboard/chart?user_id=${user.id}&type=${type}`);
 | 
				
			||||||
            if (response.ok) {
 | 
					            if (response.ok) {
 | 
				
			||||||
                const data = await response.json();
 | 
					                const data = await response.json();
 | 
				
			||||||
                chartImage.value = data.chart;
 | 
					                chartImage.value = data.chart;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user