Skip to content

Commit

Permalink
Updated rest urls for users 0.2.2. See #8
Browse files Browse the repository at this point in the history
  • Loading branch information
MKHenson committed Apr 13, 2016
1 parent a745842 commit cb29fa5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion admin/lib/authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
private _q: ng.IQService;
private _usersURL: string;
public static user: UsersInterface.IUserEntry;

// $inject annotation.
public static $inject = ["$http", "$q", "usersURL"];
constructor(http: ng.IHttpService, q: ng.IQService, usersURL: string )
Expand Down
4 changes: 2 additions & 2 deletions admin/lib/states/login/login-ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
this.error = false;
this.errorMsg = "Hello";
}

/**
* Attempts to log the user in
*/
Expand All @@ -48,7 +48,7 @@
this.errorMsg = "";
this.loading = true;

this.http.post<UsersInterface.IAuthenticationResponse>(`${host}/login`, token).then(function (response)
this.http.post<UsersInterface.IAuthenticationResponse>(`${host}/users/login`, token).then(function (response)
{
var responseToken = response.data;
if (responseToken.error)
Expand Down
2 changes: 1 addition & 1 deletion admin/lib/states/media/media-ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
var command = "";

if (that.selectedFolder)
command = `${that.usersURL}/users/${Authenticator.user.username}/buckets/${that.selectedFolder.name}/get-files?index=${index}&limit=${limit}&search=${that.searchTerm}`
command = `${that.usersURL}/users/${Authenticator.user.username}/buckets/${that.selectedFolder.name}/files?index=${index}&limit=${limit}&search=${that.searchTerm}`
else
command = `${that.usersURL}/users/${Authenticator.user.username}/buckets?index=${index}&limit=${limit}&search=${that.searchTerm}`

Expand Down
2 changes: 1 addition & 1 deletion admin/lib/states/register/register-ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
token.challenge = Recaptcha.get_challenge();
token.captcha = Recaptcha.get_response();

this.http.post<UsersInterface.IAuthenticationResponse>(`${that.usersURL}/register`, token).then(function (response)
this.http.post<UsersInterface.IAuthenticationResponse>(`${that.usersURL}/users/register`, token).then(function (response)
{
var responseToken = response.data;
if (responseToken.error)
Expand Down
4 changes: 2 additions & 2 deletions admin/lib/states/users/users-ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
this.errorMsg = "";
this.loading = true;

that.http.delete<UsersInterface.IResponse>(`${that.usersURL}/users/${user.username}/remove-user`).then(function (token)
that.http.delete<UsersInterface.IResponse>(`${that.usersURL}/users/${user.username}`).then(function (token)
{
if (token.data.error) {
that.error = true;
Expand Down Expand Up @@ -128,7 +128,7 @@

registerToken.privileges = registerToken.type == "2" ? 2 : 3;

that.http.post<UsersInterface.IGetUser>(`${that.usersURL}/create-user`, registerToken).then(function(token)
that.http.post<UsersInterface.IGetUser>(`${that.usersURL}/users`, registerToken).then(function(token)
{
if (token.data.error) {
that.error = true;
Expand Down
4 changes: 2 additions & 2 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var tempPost = null;
describe('Log in as an admin user', function() {
it('logged in with a valid username & valid password', function(done){
usersAgent
.post('/login').set('Accept', 'application/json').expect(200).expect('Content-Type', /json/)
.post('/users/login').set('Accept', 'application/json').expect(200).expect('Content-Type', /json/)
.send({username: uconfig.adminUser.username, password: uconfig.adminUser.password })
.end(function(err, res) {
test.bool(res.body.error).isNotTrue()
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('Testing all post related endpoints', function() {
done();
});
})

it('Cannot create a post without a slug field', function(done) {
modepressAgent
.post('/api/posts/create-post').set('Accept', 'application/json').expect(200).expect('Content-Type', /json/)
Expand Down

0 comments on commit cb29fa5

Please sign in to comment.