mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-16 00:50:18 -04:00
integrate digitalocean api
This commit is contained in:
parent
08e0a0aed2
commit
14c4ded29e
3
.env
3
.env
|
@ -1 +1,2 @@
|
|||
REACT_APP_API_ENDPOINT=http://localhost:5000/api
|
||||
REACT_APP_API_ENDPOINT_0=http://localhost:5000/api
|
||||
REACT_APP_API_DOMAIN=https://wheelshare-altbackend-2efyw.ondigitalocean.app/
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
const domain = process.env.REACT_APP_API_DOMAIN;
|
||||
|
||||
console.log({ domain });
|
||||
|
||||
export async function createSession(code: string, redirectUrl: string) {
|
||||
const res = await fetch('http://localhost:5000/create_session', {
|
||||
const res = await fetch(domain + 'create_session', {
|
||||
method: 'post',
|
||||
body: JSON.stringify({ code, redirectUrl }),
|
||||
headers: {
|
||||
|
|
|
@ -2,8 +2,10 @@ import { IEventSignup } from './Event';
|
|||
import { GroupPreview } from './GroupJoinerLink';
|
||||
import { IInvitation } from './types';
|
||||
|
||||
const base = process.env.REACT_APP_API_DOMAIN + 'api';
|
||||
|
||||
async function post(path: string, data: any) {
|
||||
const res = await fetch('http://localhost:5000/api' + path, {
|
||||
const res = await fetch(base + path, {
|
||||
method: 'post',
|
||||
body: JSON.stringify(data),
|
||||
headers: {
|
||||
|
@ -15,7 +17,7 @@ async function post(path: string, data: any) {
|
|||
}
|
||||
|
||||
async function delete$(path: string) {
|
||||
const res = await fetch('http://localhost:5000/api' + path, {
|
||||
const res = await fetch(base + path, {
|
||||
method: 'delete',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + localStorage.getItem('session_token'),
|
||||
|
@ -26,7 +28,7 @@ async function delete$(path: string) {
|
|||
}
|
||||
|
||||
async function get(path: string) {
|
||||
const res = await fetch('http://localhost:5000/api' + path, {
|
||||
const res = await fetch(base + path, {
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + localStorage.getItem('session_token'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user