Skip to content

Commit

Permalink
[fix] .env PUBLIC API 주소 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
harin0707 committed May 31, 2024
1 parent 2f21224 commit 76995fb
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useAddComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useAddComment = () => {

try{
const issueId = Number(localStorage.getItem('issueId'));
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/comments?issueId=${issueId}`;
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/comments?issueId=${issueId}`;

const response = await axios.post(url, newComment,{
headers:{
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCreateNewIssue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const useCreateNewIssue = () => {
console.log(requestBody);

try{
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/issues?projectId=${projectId}`;
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/issues?projectId=${projectId}`;

const response = await fetch(url,{
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCreateNewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const useCreateNewProject = () => {

try{

const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/projects`,{
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/projects`,{
method: 'POST',
headers:{
'Content-Type': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDeleteComment.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const useDeleteComment = async (commentId: string): Promise<boolean> => {
try {
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/comments?commentId=${commentId}`;
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/comments?commentId=${commentId}`;
const response = await fetch(url, {
method: 'DELETE',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFetchComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const [errorC, setError] = useState<string | null>(null);
setLoading(true);
try {
const id = localStorage.getItem('issueId');
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}?issueId=${id}`);
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}/api/v1?issueId=${id}`);

console.log(url);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFetchData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useFetchData = <T,>(endpoint: string, fetchedData: (data: any) => T): Fetc
const fetchData = async () => {
setLoading(true);
try {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}`);
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1${endpoint}`);
if (!response.ok) {
throw new Error('Network response was not ok');
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFetchIssue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fetchData = useCallback(async () => {
setLoading(true);
try {
const id = localStorage.getItem('projectId');
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}?projectId=${id}`);
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1${endpoint}?projectId=${id}`);

console.log(url);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFetchIssueDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ useEffect(() => {
setLoading(true);
try {
const id = localStorage.getItem('issueId');
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}?issueId=${id}`);
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1${endpoint}?issueId=${id}`);

console.log(url);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFetchProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const [projectData, setProjectData] = useRecoilState(projectState);
setLoading(true);
try {
const id = localStorage.getItem('userId');
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}?userId=${id}`);
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1${endpoint}?userId=${id}`);
const response = await fetch(url.toString());


Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ const useLogin = () => {

const requestBody = JSON.stringify({ username, password});

const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/users/login`;

console.log(requestBody);
console.log(url);

try{

const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/users/login`,{
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/users/login`,{
method: 'POST',
headers:{
'Content-Type': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type UsePatchReturnType = PatchFunction;
const usePatch = async(endpoint:string, issueId:number): Promise<PatchFunction> =>{
const patchStatus: PatchFunction = async (issueData: UpdateIssueInfo) => {

const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/${endpoint}?issueId=${issueId}`;
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/${endpoint}?issueId=${issueId}`;
const requestBody = JSON.stringify(issueData);
const requestOption = {
method: 'PATCH',
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useStastics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const [userIdT, setUserId] = useRecoilState<number>(userIdState);
setLoading(true);
try {
const id = localStorage.getItem('userId');
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}${endpoint}?userId=${id}`);
const url = new URL(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1${endpoint}?userId=${id}`);

const response = await fetch(url.toString());
if (!response.ok) {
Expand Down

0 comments on commit 76995fb

Please sign in to comment.