Browse Source

refactored RPC utility

Rafał Pitoń 10 years ago
parent
commit
7cde93261a
2 changed files with 3 additions and 3 deletions
  1. 2 2
      misago/emberapp/app/utils/rpc.js
  2. 1 1
      misago/emberapp/tests/unit/utils/rpc-test.js

+ 2 - 2
misago/emberapp/app/utils/rpc.js

@@ -16,7 +16,7 @@ export function buildUrl(procedure, config) {
 
   finalUrl += procedure;
 
-  if (config.API_ADD_TRAILING_SLASHES && !endsWith(procedure, '/')) {
+  if (config.API_ADD_TRAILING_SLASHES && !endsWith(finalUrl, '/')) {
     finalUrl += '/';
   }
 
@@ -58,6 +58,6 @@ export function ajax(url, data) {
   }, 'RPC: ' + url);
 }
 
-export function rpc(procedure, data, config) {
+export default function(procedure, data, config) {
   return ajax(buildUrl(procedure, config), data);
 }

+ 1 - 1
misago/emberapp/tests/unit/utils/rpc-test.js

@@ -1,5 +1,5 @@
 import Ember from 'ember';
-import {buildUrl, ajax, rpc} from '../../../utils/rpc';
+import { default as rpc, buildUrl, ajax } from '../../../utils/rpc';
 import { module, test } from 'qunit';
 
 module('RPC', {