diff --git a/scripts/join.js b/scripts/join.js index cac54ed..82ef183 100644 --- a/scripts/join.js +++ b/scripts/join.js @@ -3,14 +3,6 @@ const insertAxios = axios.create({ withCredentials: true, }); -const closePopup = () => { - setTimeout(() => window.close(), 3000); -}; - -const preventReload = (event) => { - event.preventDefault(); -}; - const dateFormat = (date) => { if (!date) return "-"; return dayjs(date).format("H시 m분 s초"); @@ -27,38 +19,29 @@ const getAccessToken = () => { return searchParams.get("authorization"); }; +const Authorization = getAccessToken(); + const getUserCheckIn = async () => { - const Authorization = getAccessToken(); const { data } = await insertAxios.get("/checkIn", { headers: { Authorization }, }); return data; }; -const getAllCheckIn = async () => { - const Authorization = getAccessToken(); - const { data } = await insertAxios.get("checkIn/all", { - headers: { Authorization }, - }); - return data; -}; - const requestCheckIn = async (requestData) => { - const Authorization = getAccessToken(); const { data } = await insertAxios.post( "/checkIn", { ...requestData }, - { headers: { Authorization } } + { headers: { Authorization } }, ); return data; }; const createRoom = async (requestData) => { - const Authorization = getAccessToken(); const { data } = await insertAxios.post( "/room/allocate", { ...requestData }, - { headers: { Authorization } } + { headers: { Authorization } }, ); return data; }; @@ -79,8 +62,6 @@ const INFO_BOX = { BOX: "info--box", }; -const MEMBERS = "members"; - const form = element["@id"](INFO_BOX.FORM); const box = element["@id"](INFO_BOX.BOX); diff --git a/scripts/view.js b/scripts/view.js index 3e33f6b..f266b0f 100644 --- a/scripts/view.js +++ b/scripts/view.js @@ -3,10 +3,6 @@ const insertAxios = axios.create({ withCredentials: true, }); -const closePopup = () => { - setTimeout(() => window.close(), 5000); -}; - const dateFormat = (date) => { if (!date) return "-"; return dayjs(date).format("H시 m분 s초"); @@ -18,55 +14,11 @@ const element = { "@query": (query) => document.querySelector(query), }; -const getUserCheckIn = async () => { - const Authorization = getAccessToken(); - const { data } = await insertAxios.get("/checkIn", { - headers: { Authorization }, - }); - return data; -}; - const getAllCheckIn = async () => { const { data } = await insertAxios.get("checkIn/all"); return data; }; -const requestCheckIn = async (requestData) => { - const Authorization = getAccessToken(); - const { data } = await insertAxios.post( - "/checkIn", - { ...requestData }, - { headers: { Authorization } } - ); - return data; -}; - -const createRoom = async (requestData) => { - const Authorization = getAccessToken(); - const { data } = await insertAxios.post( - "/room/allocate", - { requestData }, - { headers: { Authorization } } - ); - return data; -}; - -const USER = { - NAME: "user--name", - DORMITORY_TYPE: "user--dormitoryType", - ROOM_NUMBER: "user--roomNumber", - SUB_NAME: "user--subName", -}; - -const CHECK_IN = { - BUTTON: "checkin--button", -}; - -const INFO_BOX = { - FORM: "info--form", - BOX: "info--box", -}; - const MEMBERS = "members"; (async () => {