Skip to content

Commit

Permalink
changed request api in front
Browse files Browse the repository at this point in the history
  • Loading branch information
nik1t7n committed Sep 13, 2024
1 parent b509439 commit 45184a3
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions frontend/nebula/src/components/AITooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const AITooltip: React.FC = () => {
}

try {
const response = await fetch('http://127.0.0.1:8000/notes/all?limit=1000000', {
const response = await fetch('http://138.197.30.86:8000/notes/all?limit=1000000', {
headers: {
'Authorization': `Bearer ${token}`,
'accept': 'application/json'
Expand All @@ -56,7 +56,7 @@ const AITooltip: React.FC = () => {
}

try {
const response = await fetch(`http://127.0.0.1:8000/entry-analyze/analyze-entry?note_id=${noteId}`, {
const response = await fetch(`http://138.197.30.86:8000/entry-analyze/analyze-entry?note_id=${noteId}`, {
headers: {
'Authorization': `Bearer ${token}`,
'accept': 'application/json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getContextFactorId = async (russianFactor: RussianContextFactor): Promise<
try {
const englishFactor = contextFactorMap[russianFactor];

const response = await axios.get<ContextFactor[]>('http://127.0.0.1:8000/context-factor/all');
const response = await axios.get<ContextFactor[]>('http://138.197.30.86:8000/context-factor/all');
const factors = response.data;

const foundFactor = factors.find(factor => factor.name === englishFactor);
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/components/test/EffectComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getEffectId = async (russianEffect: RussianEffect): Promise<number | null>
try {
const englishEffect = effectMap[russianEffect];

const response = await axios.get<Effect[]>('http://127.0.0.1:8000/effect/all');
const response = await axios.get<Effect[]>('http://138.197.30.86:8000/effect/all');
const effects = response.data;

const foundEffect = effects.find(effect => effect.name === englishEffect);
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/components/test/EmotionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getEmotionId = async (russianEmotion: RussianEmotion): Promise<number | nu
try {
const englishEmotion = emotionMap[russianEmotion];

const response = await axios.get<Emotion[]>('http://127.0.0.1:8000/emotion/all');
const response = await axios.get<Emotion[]>('http://138.197.30.86:8000/emotion/all');
const emotions = response.data;

const foundEmotion = emotions.find(emotion => emotion.name === englishEmotion);
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const HomePage: React.FC = () => {
throw new Error("Токен не найден в localStorage");
}

const response = await fetch("http://127.0.0.1:8000/mood-entry/create", {
const response = await fetch("http://138.197.30.86:8000/mood-entry/create", {
method: "POST",
headers: {
Accept: "application/json",
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ProfilePage: React.FC = () => {
throw new Error('No token found');
}

const response = await fetch('http://127.0.0.1:8000/auth/current/user', {
const response = await fetch('http://138.197.30.86:8000/auth/current/user', {
headers: {
'Authorization': `Bearer ${token}`,
'accept': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/pages/StatisticsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const StatisticsPage: React.FC = () => {
}

const response = await axios.get<DashboardData>(
"http://127.0.0.1:8000/analytics/by-date",
"http://138.197.30.86:8000/analytics/by-date",
{
params: {
start_date: startDate.toISOString().split("T")[0],
Expand Down
12 changes: 6 additions & 6 deletions frontend/nebula/src/services/noteService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const mockNotes: Note[] = [
export const getNotes = async (
cursor?: string
): Promise<{ notes: Note[]; nextCursor: string | null }> => {
const notesUrl = "http://127.0.0.1:8000/notes/all";
const moodsUrl = "http://127.0.0.1:8000/mood-content/all";
const notesUrl = "http://138.197.30.86:8000/notes/all";
const moodsUrl = "http://138.197.30.86:8000/mood-content/all";

try {
// Запрос для получения списка всех доступных эмоций
Expand Down Expand Up @@ -90,7 +90,7 @@ export const getNotes = async (

const getMoodId = async (mood: MoodType): Promise<number> => {
try {
const response = await fetch("http://127.0.0.1:8000/mood-content/all", {
const response = await fetch("http://138.197.30.86:8000/mood-content/all", {
method: "GET",
headers: {
Accept: "application/json",
Expand Down Expand Up @@ -152,7 +152,7 @@ export const createNote = async (

console.log(body); // Для отладки

const response = await fetch("http://127.0.0.1:8000/notes/create", {
const response = await fetch("http://138.197.30.86:8000/notes/create", {
method: "POST",
headers: {
Accept: "application/json",
Expand Down Expand Up @@ -204,7 +204,7 @@ export const updateNote = async (

// Выполняем PATCH-запрос
const response = await fetch(
`http://127.0.0.1:8000/notes/update?note_id=${id}`,
`http://138.197.30.86:8000/notes/update?note_id=${id}`,
{
method: "PATCH",
headers: {
Expand Down Expand Up @@ -234,7 +234,7 @@ export const updateNote = async (
export const deleteNote = async (id: number): Promise<void> => {
try {
const response = await fetch(
`http://127.0.0.1:8000/notes/delete?note_id=${id}`,
`http://138.197.30.86:8000/notes/delete?note_id=${id}`,
{
method: "DELETE",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/nebula/src/services/userService.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import { LoginResponse } from '../types/authTypes';

const API_URL = 'http://127.0.0.1:8000';
const API_URL = 'http://138.197.30.86:8000';

interface RegisterUserData {
name: string;
Expand Down
6 changes: 3 additions & 3 deletions frontend/nebula/src/services/utilsSerivce.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const getEmotionId = async (
const englishEmotion = emotionMap[russianEmotion];

const response = await axios.get<Emotion[]>(
"http://127.0.0.1:8000/emotion/all"
"http://138.197.30.86:8000/emotion/all"
);
const emotions = response.data;

Expand All @@ -117,7 +117,7 @@ export const getContextFactorId = async (
const englishFactor = contextFactorMap[russianFactor];

const response = await axios.get<ContextFactor[]>(
"http://127.0.0.1:8000/context-factor/all"
"http://138.197.30.86:8000/context-factor/all"
);
const factors = response.data;

Expand All @@ -137,7 +137,7 @@ export const getEffectId = async (
const englishEffect = effectMap[russianEffect];

const response = await axios.get<Effect[]>(
"http://127.0.0.1:8000/effect/all"
"http://138.197.30.86:8000/effect/all"
);
const effects = response.data;

Expand Down

0 comments on commit 45184a3

Please sign in to comment.