diff --git a/lib/api.js b/lib/api.js index 19155ee0..1a9b5bf7 100644 --- a/lib/api.js +++ b/lib/api.js @@ -35,7 +35,7 @@ export async function sign_up({ } export async function getLeaderboard(date) { - const response = await API.get(`/api/v1/leaderboard/${date}`); + const response = await API.get(`/api/leaderboard/${date}`); return response.data; } @@ -50,13 +50,13 @@ export async function sign_in({ email, password }) { } export async function getReedemable(uuid) { - const response = await API.get(`/api/v1/store/redeem/${uuid}`); + const response = await API.get(`/api/store/redeem/${uuid}`); return response.data; } export async function redeem(attendee, prize, amount) { - const response = await API.post("/api/v1/store/redeem", { + const response = await API.post("/api/store/redeem", { redeem: { attendee_id: attendee, redeemable: prize, @@ -68,7 +68,7 @@ export async function redeem(attendee, prize, amount) { } export async function redeemWheel(attendee, prize, amount) { - const response = await API.post("/api/v1/roulette/redeem", { + const response = await API.post("/api/roulette/redeem", { redeem: { attendee_id: attendee, prize: prize, @@ -80,7 +80,7 @@ export async function redeemWheel(attendee, prize, amount) { } export async function redeemBadge(uuid, selectedBadge) { - const response = await API.post("/api/v1/redeems", { + const response = await API.post("/api/redeems", { redeem: { attendee_id: uuid, badge_id: selectedBadge, @@ -125,43 +125,43 @@ export async function sendResetEmail({ email }) { } export async function getAttendee(id) { - const response = await API.get(`/api/v1/attendees/${id}`); + const response = await API.get(`/api/attendees/${id}`); return response.data; } export async function getWheelPrizes() { - const response = await API.get("/api/v1/roulette/prizes"); + const response = await API.get("/api/roulette/prizes"); return response.data; } export async function getWheelRedeemables(uuid) { - const response = await API.get(`/api/v1/roulette/redeem/${uuid}`); + const response = await API.get(`/api/roulette/redeem/${uuid}`); return response.data; } export async function getAllBadges() { - const response = await API.get("/api/v1/badges"); + const response = await API.get("/api/badges"); return response.data; } export async function getWheelLatestWins() { - const response = await API.get("/api/v1/roulette/latestwins"); + const response = await API.get("/api/roulette/latestwins"); return response.data; } export async function spinWheel() { - const response = await API.post("/api/v1/roulette"); + const response = await API.post("/api/roulette"); return response.data; } export async function referral(id) { - const response = await API.post("/api/v1/referrals", { + const response = await API.post("/api/referrals", { id: id, }); @@ -169,28 +169,28 @@ export async function referral(id) { } export async function isAttendeeRegistered(id) { - const response = await API.get(`/api/v1/is_registered/${id}`); + const response = await API.get(`/api/is_registered/${id}`); return response; } export async function getCurrentUser() { - const response = await API.get("/api/v1/user"); + const response = await API.get("/api/user"); const { type } = response.data; if (type) { switch (type) { case USER.ROLES.ATTENDEE: - const { data: attendee } = await API.get("/api/v1/attendee"); + const { data: attendee } = await API.get("/api/attendee"); const { data: { data: extras }, - } = await API.get(`/api/v1/attendees/${attendee.id}`); + } = await API.get(`/api/attendees/${attendee.id}`); return { ...attendee, ...extras, type }; case USER.ROLES.MANAGER: return response.data; case USER.ROLES.SPONSOR: - const { data: company } = await API.get("/api/v1/company"); + const { data: company } = await API.get("/api/company"); return { ...company, user_id: response.data.id, type }; default: @@ -202,25 +202,25 @@ export async function getCurrentUser() { } export async function getBadge(id) { - const response = await API.get(`/api/v1/badges/${id}`); + const response = await API.get(`/api/badges/${id}`); return response; } export async function testEdit(id, formData) { - const response = await API.patch(`/api/v1/attendees/${id}`, formData); + const response = await API.patch(`/api/attendees/${id}`, formData); return response.data; } export async function editUser(id, formData) { - const response = await API.patch(`/api/v1/attendees/${id}`, formData); + const response = await API.patch(`/api/attendees/${id}`, formData); return response.data; } export async function giveBadge(attendee_id, badge_id) { - const response = await API.post("/api/v1/redeems", { + const response = await API.post("/api/redeems", { redeem: { attendee_id, badge_id, @@ -231,32 +231,32 @@ export async function giveBadge(attendee_id, badge_id) { } export async function getProducts() { - const response = await API.get("/api/v1/store"); + const response = await API.get("/api/store"); return response.data; } export async function getProduct(id) { - const response = await API.get(`/api/v1/store/${id}`); + const response = await API.get(`/api/store/${id}`); return response; } export async function buyProduct(id) { - const response = await API.post(`/api/v1/store/buy/`, { + const response = await API.post(`/api/store/buy/`, { redeemable: { redeemable_id: id }, }); return response.data; } export async function getCompanyVisitors(id) { - const response = await API.get(`/api/v1/company/attendees/${id}`); + const response = await API.get(`/api/company/attendees/${id}`); return response.data; } export async function downloadCVInBulk(id) { - const response = await API.get(`/api/v1/company/attendees/cvs/${id}`, { + const response = await API.get(`/api/company/attendees/cvs/${id}`, { responseType: "blob", });