Skip to content

Commit

Permalink
204 is fine for a status code
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed Oct 29, 2024
1 parent c4f8a0c commit 99e9f5b
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/views/dashboard/ApiTokens/ApiTokenRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/tokens/${item.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res);
}
Expand All @@ -187,7 +187,7 @@ export default {
name: this.editing.token.name,
});
if (res === undefined || res.status !== 200) {
if (res === undefined || res.status !== 200 && res.status !== 204) {
this.$swal('Error', 'Error while updating new token', 'error');
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/dashboard/devices/DevicesRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('PUT', `1/devices/${item.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
Expand Down Expand Up @@ -185,7 +185,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/devices/${item.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
Expand Down Expand Up @@ -252,7 +252,7 @@ export default {
name: this.editItem.name
});
if (res === undefined || res.status !== 200) {
if (res === undefined || res.status !== 200 && res.status !== 204) {
toastr.error("Error while updating device");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shares/links/ShareLinkShocker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/shares/links/${this.$route.params.id}/${this.shocker.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shares/links/ViewShareLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default {
async addShockerAction() {
if (!this.validateAddShocker) return;
const res = await apiCall.makeCall('POST', `1/shares/links/${this.id}/${this.addShocker.selectedShocker}`);
if (res === undefined || res.status !== 200) {
if (res === undefined || res.status !== 200 && res.status !== 204) {
toastr.error("Error while adding shocker to share link");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shockers/own/Own.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export default {
model: this.retrievedShocker.model
});
if (res === undefined || res.status !== 200) {
if (res === undefined || res.status !== 200 && res.status !== 204) {
toastr.error("Error while updating shocker");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shockers/own/OwnShocker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/shockers/${this.shocker.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/dashboard/shockers/own/shares/ShockerSharesRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/shares/code/${code.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res);
}
Expand Down Expand Up @@ -319,7 +319,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/shockers/${this.$route.params.id}/shares/${share.sharedWith.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res);
}
Expand Down Expand Up @@ -358,7 +358,7 @@ export default {
intensity: temp.limitsTranslated.intensity == 100 ? null : temp.limitsTranslated.intensity
}
});
if (res === undefined || res.status !== 200) {
if (res === undefined || res.status !== 200 && res.status !== 204) {
toastr.error("Error while creating share code");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shockers/shared/Shared.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
preConfirm: async (id) => {
try {
const res = await apiCall.makeCall('POST', `1/shares/code/${id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/shockers/shared/SharedShocker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default {
preConfirm: async () => {
try {
const res = await apiCall.makeCall('DELETE', `1/shockers/${this.shocker.id}/shares/${this.$store.state.user.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/public/proxy/ShareCodeProxy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
try {
const res = await apiCall.makeCall('POST', `1/shares/code/${this.id}`);
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 204) {
throw new Error(res.statusText);
}
toastr.success(`Failed to add share: ${utils.getError(err)}`);
Expand Down

0 comments on commit 99e9f5b

Please sign in to comment.