fixes
This commit is contained in:
@ -14,8 +14,6 @@ services:
|
|||||||
context: react
|
context: react
|
||||||
ports:
|
ports:
|
||||||
- "3000"
|
- "3000"
|
||||||
environment:
|
|
||||||
- WDS_SOCKET_PORT=0
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./react/app:/app:z
|
- ./react/app:/app:z
|
||||||
# - ./docker_cache/node_modules:/app/node_modules
|
# - ./docker_cache/node_modules:/app/node_modules
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
FROM node:20.1
|
FROM node:20.1
|
||||||
|
|
||||||
|
ENV CI=true
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
ENV WDS_SOCKET_PORT=0
|
||||||
|
ENV REACT_APP_DOMAIN=127.0.0.1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY /app /app
|
COPY /app /app
|
||||||
# COPY package.json /app/package.json
|
# COPY package.json /app/package.json
|
||||||
@ -10,8 +16,6 @@ RUN npm ci
|
|||||||
|
|
||||||
# COPY . /app
|
# COPY . /app
|
||||||
#
|
#
|
||||||
ENV CI=true
|
|
||||||
ENV PORT=3000
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
|
|
||||||
|
RUN printenv
|
||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "start" ]
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const Snippet = ({ id }) => {
|
|||||||
const { authTokens } = useContext(AuthContext);
|
const { authTokens } = useContext(AuthContext);
|
||||||
const [ snippet, setSnippet ] = useState("");
|
const [ snippet, setSnippet ] = useState("");
|
||||||
const getSnippet = async (id) => {
|
const getSnippet = async (id) => {
|
||||||
const response = await fetch(`http://127.0.0.1/api/snippets/${id}`, {
|
const response = await fetch(`http://${process.env.REACT_APP_DOMAIN}/api/snippets/${id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${authTokens.access}`,
|
"Authorization": `Bearer ${authTokens.access}`,
|
||||||
@ -31,7 +31,7 @@ const Snippet = ({ id }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const updateSnippet = async (id, snippet) => {
|
const updateSnippet = async (id, snippet) => {
|
||||||
const response = await fetch(`http://127.0.0.1/api/snippets/${id}`, {
|
const response = await fetch(`http://${process.env.REACT_APP_DOMAIN}/api/snippets/${id}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${authTokens.access}`,
|
"Authorization": `Bearer ${authTokens.access}`,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export const AuthProvider = ({ children }) => {
|
|||||||
const history = useNavigate();
|
const history = useNavigate();
|
||||||
|
|
||||||
const loginUser = async (username, password) => {
|
const loginUser = async (username, password) => {
|
||||||
const response = await fetch("http://127.0.0.1/api/auth/token/", {
|
const response = await fetch(`http://${process.env.REACT_APP_DOMAIN}/api/auth/token/`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
@ -46,7 +46,7 @@ export const AuthProvider = ({ children }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const registerUser = async (username, password, password2) => {
|
const registerUser = async (username, password, password2) => {
|
||||||
const response = await fetch("http://127.0.0.1/api/auth/register/", {
|
const response = await fetch(`http://${process.env.REACT_APP_DOMAIN}/api/auth/register/`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import dayjs from "dayjs";
|
|||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import AuthContext from "../context/AuthContext";
|
import AuthContext from "../context/AuthContext";
|
||||||
|
|
||||||
const baseURL = "http://127.0.0.1/api/auth";
|
const baseURL = `http://${process.env.REACT_APP_DOMAIN}/api/auth`;
|
||||||
|
|
||||||
const useAxios = () => {
|
const useAxios = () => {
|
||||||
const { authTokens, setUser, setAuthTokens } = useContext(AuthContext);
|
const { authTokens, setUser, setAuthTokens } = useContext(AuthContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user