-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV-127: replace fetch calls with axios #480
base: development
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Share plan fails and droppable thing doesn't work anymore
@josephined21 help?
axios | ||
.patch(getAPI(window) + '/plans/update', body, { | ||
headers: { ContentType: 'application/json', Authorization: `Bearer ${token}` }, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update plan name / majors
axios | ||
.patch(getAPI(window) + '/years/changeOrder', body, { | ||
headers: { | ||
'Content-Type': 'application/json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has this been addressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"no" - minseo
@@ -232,32 +231,30 @@ const CourseList: FC<Props> = ({ mode }) => { | |||
newTerm: destination.semester, | |||
}; | |||
|
|||
let res: any = await fetch(getAPI(window) + '/courses/dragged', { | |||
method: 'PATCH', | |||
let res = await axios.patch(getAPI(window) + '/courses/dragged', body, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dragging courses to new semester works
error check too
axios | ||
.post(getAPI(window) + '/courses', body, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding course from Semester works
axios | ||
.patch(getAPI(window) + '/years/updateName', body, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works
if (planList[i]._id === newPlan._id) { | ||
newPlanList[i] = newPlan; | ||
} | ||
const handlePostAddCourse = (plan: Plan) => (data): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add course to update
} | ||
}); | ||
newPlan = { ...currentPlan, years: years }; | ||
axios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete course works
axios | ||
.delete(getAPI(window) + '/plans/' + currentPlan._id, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete plan works
Authorization: `Bearer ${token}`, | ||
}, | ||
}) | ||
axios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete year works
if (error.status === 400) { | ||
toast.error(error.detail); | ||
} | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add course from coursesearch works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment above ^.^
…s function from userService
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
description
for sake of consistency, replace all uses of fetch with axios
Also, for DEV-126 Refactor API calls to userService
implementation
for DEV-126:
Refactored API calls:
- Refactored the call in RoadmapComment.tsx with getThreads
from userService
- Wrote getPlanByUser in userService
- Refactored the call in HandleUserInfoSetUpDummy.tsx with
getPlanByUser
- Wrote createNewPlan in userService
- Refactored the call in GenerateNewPlan.tsx
- Wrote getYear in userService
- Refactored the call in HandlePlanShareDummy.tsx
- Wrote deletePlan in userService
- Refactored the call in DeletePlanPopup.tsx
- Refactored the call in Comment.tsx with postNewComment
function in userService
- Refactored the call in NewComment.tsx with postNewThread
function in userService
- Wrote deleteNotifications function in userService
- Refactored the call in Notification.tsx
- Wrote updateYear in userService
- Refactored the call in YearSettingsDropdown.tsx
Not refactored into userService:
- error handling creates a toast
- request has ContentType header in addition to Authorization
header
- empty array returned in error handling
- setSearching(false) called in error handling
- No longer exists in updated DEV-127 branch
- Error handling creates a toast
- Has ContentType header in addition to authorization header
- Has ContentType header in addition to authorization header
- Has ContentType header in addition to authorization header
- Not worth refactoring because attempt to refactor would lead
to more lines of code than what already exist
- Not worth refactoring because attempt to refactor would lead
to more lines of code than what already exist