Skip to content

Commit ac5998c

Browse files
authored
Merge pull request #53 from evan-bradley/backend-documentation
Backend documentation
2 parents 5785dd2 + 5c67de6 commit ac5998c

File tree

11 files changed

+628
-149
lines changed

11 files changed

+628
-149
lines changed

client/src/components/Browse.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
methods: {
5858
loadChannels () {
59-
this.$http.get(`/api/channels/${this.user.Id}`)
59+
this.$http.get(`/api/user/${this.user.Id}/channels`)
6060
.then(response => {
6161
if (response.data.success) {
6262
this.$store.commit('setChannels', response.data.channels)

client/src/components/ChangeEmail.vue

+6-22
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,16 @@
4545
if (this.errors.any()) {
4646
return
4747
}
48-
const passwordVerificationBody = {
49-
password: this.password
50-
}
5148
const emailModificationBody = {
52-
id: this.user.Id,
53-
NewEmail: this.email,
54-
currentEmail: this.user.Email,
49+
email: this.email,
5550
password: this.password
5651
}
57-
// TODO: We should combine these two requests into one.
58-
this.$http.post('/api/verify/password', passwordVerificationBody)
52+
53+
this.$http.put(`/api/user/${this.user.Id}/email`, emailModificationBody)
5954
.then(response => {
60-
if (response.data.success) {
61-
this.$http.post(`/api/profile/ChangeEmail/${this.user.Id}`, emailModificationBody)
62-
.then(response => {
63-
if (response.body.success) {
64-
this.user.Email = emailModificationBody.NewEmail
65-
this.$router.push({name: 'EditProfile'})
66-
} else {
67-
console.log(response)
68-
this.failureMessage = response.data.message
69-
}
70-
}, response => {
71-
this.failureMessage = response.data.message
72-
console.log(response)
73-
})
55+
if (response.body.success) {
56+
this.user.Email = emailModificationBody.NewEmail
57+
this.$router.push({name: 'EditProfile'})
7458
} else {
7559
console.log(response)
7660
this.failureMessage = response.data.message

client/src/components/Channel.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
methods: {
4646
loadChannelInformation () {
4747
var channelId = this.$route.params.channelId
48-
this.$http.get(`/api/channel/${channelId}`)
48+
this.$http.get(`/api/channels/${channelId}`)
4949
.then(response => {
5050
if (response.data.success) {
5151
this.channel = response.body.channel

client/src/components/Interests.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
if (!this.canSubmitChannels()) return
7373
7474
// Send the channels that the user selected to the server
75-
var body = {
75+
const body = {
7676
channels: this.selectedChannels
7777
}
78-
this.$http.post(`/api/channels/${this.user.Id}`, body)
78+
this.$http.post(`/api/user/${this.user.Id}/channels`, body)
7979
.then(response => {
8080
if (response.data.success) {
8181
this.$router.push({ name: 'Browse' })

client/src/components/VotingItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
console.log('clicked previous')
8989
},
9090
next () {
91-
this.$http.get(`/api/product?channelId=${this.channel}`)
91+
this.$http.get(`/api/product/random?channelId=${this.channel}`)
9292
.then(response => { // Success
9393
if (response.data.success) {
9494
this.itemName = response.data.product.name.substring(0, 30)

server/package-lock.json

+180
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"author": "",
1717
"license": "GPL-3.0",
1818
"dependencies": {
19+
"apidoc": "^0.17.6",
1920
"bcrypt": "^1.0.3",
2021
"body-parser": "^1.17.1",
2122
"chai": "^4.1.2",

0 commit comments

Comments
 (0)