Skip to content

Commit

Permalink
use upper case methods
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed May 3, 2024
1 parent db76b81 commit 79cc9ad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/src/modules/api.js
Expand Up @@ -66,7 +66,7 @@ async function xhr(options) {
const isJSON = contentType && contentType.startsWith('application/json');

let response;
if (options.method !== 'head') {
if (options.method !== 'HEAD') {
if (isJSON) {
response = await res.json();
} else {
Expand Down Expand Up @@ -95,14 +95,14 @@ export function get(route, data, onSuccess) {
export function head(route, data, onSuccess) {
return call({
url: route + (data && Object.keys(data).length ? ('?' + $.param(data)) : ''),
method: 'head',
method: 'HEAD',
}, onSuccess);
}

export function post(route, data, onSuccess) {
return call({
url: route,
method: 'post',
method: 'POST',
data,
headers: {
'x-csrf-token': config.csrf_token,
Expand All @@ -124,7 +124,7 @@ export function patch(route, data, onSuccess) {
export function put(route, data, onSuccess) {
return call({
url: route,
method: 'put',
method: 'PUT',
data,
headers: {
'x-csrf-token': config.csrf_token,
Expand All @@ -135,7 +135,7 @@ export function put(route, data, onSuccess) {
export function del(route, data, onSuccess) {
return call({
url: route,
method: 'delete',
method: 'DELETE',
data,
headers: {
'x-csrf-token': config.csrf_token,
Expand Down

0 comments on commit 79cc9ad

Please sign in to comment.