Skip to content

Commit

Permalink
fix : console 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jun 11, 2024
1 parent 42dd7eb commit ad329dc
Show file tree
Hide file tree
Showing 17 changed files with 1,110 additions and 716 deletions.
2 changes: 1 addition & 1 deletion src/api/auth/auth.post.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const signin = async ({ email, password }: ISignIn) => {
email,
password
});
console.log('실행1');

return response;
};

Expand Down
57 changes: 32 additions & 25 deletions src/api/map/getOfficeAvailable.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
import { BranchAvailable } from '@/api/types/branch';

function formatLocalDate() {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000;
const localISOTime = new Date(now.getTime() - offset).toISOString().slice(0, -1);
return localISOTime.split('.')[0];
}

export const getOfficeAvailable = async (name: string): Promise<{ data: BranchAvailable }> => {
try {
const backendUrl = process.env.NEXT_PUBLIC_BASE_URL;
const now = formatLocalDate();
console.log(encodeURIComponent(name));
const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1");
const response = await fetch(`${backendUrl}branches/${encodeURIComponent(name)}/space?now=${encodeURIComponent(now)}`, {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000;
const localISOTime = new Date(now.getTime() - offset).toISOString().slice(0, -1);
return localISOTime.split('.')[0];
}

export const getOfficeAvailable = async (
name: string
): Promise<{ data: BranchAvailable }> => {
try {
const backendUrl = process.env.NEXT_PUBLIC_BASE_URL;
const now = formatLocalDate();

const token = document.cookie.replace(
/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
'$1'
);
const response = await fetch(
`${backendUrl}branches/${encodeURIComponent(name)}/space?now=${encodeURIComponent(now)}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
cache: 'no-store'
});
if (!response.ok) {
throw new Error('Failed to fetch branch information');
}
const data: { data: BranchAvailable } = await response.json();
console.log(data);
return data;
} catch (error) {
console.error('Error fetching branch info:', error);
throw error;
);
if (!response.ok) {
throw new Error('Failed to fetch branch information');
}
};

const data: { data: BranchAvailable } = await response.json();

return data;
} catch (error) {
console.error('Error fetching branch info:', error);
throw error;
}
};
23 changes: 15 additions & 8 deletions src/api/reservation/getMeetingRoomInfo.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import { MeetingRoomInfo } from '../types/room';

export const getMeetingRoomInfo = async (meetingRoomId: string): Promise<MeetingRoomInfo> => {
export const getMeetingRoomInfo = async (
meetingRoomId: string
): Promise<MeetingRoomInfo> => {
const backendUrl = process.env.NEXT_PUBLIC_BASE_URL;
const url = `${backendUrl}spaces/meeting-rooms/${meetingRoomId}`;

const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1");

const token = document.cookie.replace(
/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
'$1'
);

if (!token) {
throw new Error('No access token found');
}

const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
}
});

if (!response.ok) {
const errorText = await response.text();
throw new Error(`Error fetching meeting room info: ${response.status} ${response.statusText} - ${errorText}`);
throw new Error(
`Error fetching meeting room info: ${response.status} ${response.statusText} - ${errorText}`
);
}

const data: { status: string; errorCode: string | null; data: MeetingRoomInfo } = await response.json();
console.log(data);
const data: { status: string; errorCode: string | null; data: MeetingRoomInfo } =
await response.json();

if (data.status !== 'SUCCESS') {
throw new Error(`API Error: ${data.errorCode}`);
Expand Down
15 changes: 9 additions & 6 deletions src/api/reservation/reserveMeetingRoom.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Reserve } from "../types/reserve";
import { Reserve } from '../types/reserve';

export const reserveMeetingRoom = async (reservation: Reserve): Promise<void> => {
const backendUrl = process.env.NEXT_PUBLIC_BASE_URL;
const url = `${backendUrl}reservations/meeting-rooms`;

const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1");
const token = document.cookie.replace(
/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
'$1'
);

if (!token) {
throw new Error('No access token found');
Expand All @@ -13,16 +16,16 @@ export const reserveMeetingRoom = async (reservation: Reserve): Promise<void> =>
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(reservation)
});

console.log(response);

if (!response.ok) {
const errorText = await response.text();
throw new Error(`Error reserving meeting room: ${response.status} ${response.statusText} - ${errorText}`);
throw new Error(
`Error reserving meeting room: ${response.status} ${response.statusText} - ${errorText}`
);
}
};
23 changes: 15 additions & 8 deletions src/api/reservation/searchMembers.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
import { Member } from '../types/member';

export const searchMembers = async (searchTerm: string, startAt: string, endAt: string): Promise<{ memberCanInviteList: Member[], memberCantInviteList: Member[] }> => {
export const searchMembers = async (
searchTerm: string,
startAt: string,
endAt: string
): Promise<{ memberCanInviteList: Member[]; memberCantInviteList: Member[] }> => {
const backendUrl = process.env.NEXT_PUBLIC_BASE_URL;
const url = `${backendUrl}reservations/members?startAt=${startAt}&endAt=${endAt}&searchTerm=${searchTerm}`;

const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1");

const token = document.cookie.replace(
/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
'$1'
);

if (!token) {
throw new Error('No access token found');
}

console.log(searchTerm,startAt,endAt)
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
}
});

if (!response.ok) {
const errorText = await response.text();
throw new Error(`Error searching members: ${response.status} ${response.statusText} - ${errorText}`);
throw new Error(
`Error searching members: ${response.status} ${response.statusText} - ${errorText}`
);
}

const data = await response.json();
console.log(data);

if (data.status !== 'SUCCESS') {
throw new Error(`API Error: ${data.errorCode}`);
Expand Down
1 change: 0 additions & 1 deletion src/components/community/hooks/useNoticeGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const useNoticeGet = (sortType: string) => {
const ref = useRef<HTMLDivElement | null>(null);
const pageRef = useIntersectionObserver(ref, {});
const isPageEnd = !!pageRef?.isIntersecting;
console.log(isPageEnd);
const {
data,
fetchNextPage,
Expand Down
Loading

0 comments on commit ad329dc

Please sign in to comment.