MorganBergen / clarity

Advanced ML for Nutritional Analysis and Healthcare Management
1 stars 0 forks source link

`[Error] Failed to load resource: the server responded with a status of 404 (Not Found)` #8

Closed MorganBergen closed 1 month ago

MorganBergen commented 1 month ago
[Error] Error fetching profile:
AxiosError

code: "ERR_BAD_REQUEST"

config: {transitional: {silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false}, adapter: ["xhr", "http", "fetch"], transformRequest: Array, transformResponse: Array, timeout: 0, …}

message: "Request failed with status code 404"

name: "AxiosError"

request: XMLHttpRequest {listeners: Object, onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, …}

response: {data: "<!DOCTYPE html>↵<html lang=\"en\">↵<head>↵<meta char…pi/profile/f04o20buoi2j6iq</pre>↵</body>↵</html>↵", status: 404, statusText: "Not Found", headers: AxiosHeaders, config: Object, …}

stack: "settle@http://localhost:3000/static/js/bundle.js:78204:70↵onloadend@http://localhost:3000/static/js/bundle.js:76855:6…"

status: 404

AxiosError Prototype
    (anonymous function) (bundle.js:4618)
    (anonymous function) (bundle.js:1641)
MorganBergen commented 1 month ago

something to do with

  const saveProfile = async (updatedProfile) => {
    try {
      const userId = localStorage.getItem('userId'); // Retrieve user ID from localStorage
      if (userId) {
        const response = await axios.post(`/api/profile/${userId}`, updatedProfile);
        setProfile(response.data);
      }
    } catch (error) {
      console.error('Error saving profile:', error);
    }