Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions orbit-app/src/pages/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { BASE_URL } from '../util';

export const deleteUser = async (userId) => {
async (userId) => {
if (typeof userId !== 'string' || !/^[a-zA-Z0-9_-]+$/.test(userId)) {
throw new Error('Invalid userId format');
}

const response = await axios.delete(`${BASE_URL}/delete-user/${userId}`, {
withCredentials: true,
});
Expand All @@ -13,7 +17,7 @@ export const deleteUser = async (userId) => {
}

return response.data;
};
}

export const fetchUserProfile = async (userId) => {
const response = await axios.get(`${BASE_URL}/get-user/${userId}`);
Expand Down