Skip to content

Commit

Permalink
Use new api url
Browse files Browse the repository at this point in the history
  • Loading branch information
angelguzmaning committed Nov 8, 2021
1 parent 59efcd2 commit 99498d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/config/settings.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
baseApiUrl: 'https://conduit.productionready.io/api/',
baseApiUrl: 'https://api.realworld.io/api/',
};
4 changes: 2 additions & 2 deletions src/services/conduit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ it('Should get tags', async () => {
});

it('Should send correct login object', async () => {
mockedAxios.post.mockRejectedValueOnce({ data: { errors: { x: ['y', 'z'] } } });
mockedAxios.post.mockRejectedValueOnce({ response: { data: { errors: { x: ['y', 'z'] } } } });

await login('thisIsUser', 'thisIsPassword');

Expand All @@ -113,7 +113,7 @@ it('Should send correct login object', async () => {
});

it('Should get login errors', async () => {
mockedAxios.post.mockRejectedValueOnce({ data: { errors: { x: ['y', 'z'] } } });
mockedAxios.post.mockRejectedValueOnce({ response: { data: { errors: { x: ['y', 'z'] } } } });

const result = await login('', '');
result.match({
Expand Down
2 changes: 1 addition & 1 deletion src/services/conduit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function login(email: string, password: string): Promise<Result<Use
const { data } = await axios.post('users/login', { user: { email, password } });

return Ok(guard(object({ user: userDecoder }))(data).user);
} catch ({ data }) {
} catch ({ response: { data } }) {
return Err(guard(object({ errors: genericErrorsDecoder }))(data).errors);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/types/profile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Decoder, string, nullable, boolean, object } from 'decoders';
import { Decoder, string, nullable, boolean, object, hardcoded, either } from 'decoders';
import { PublicUser } from './user';

export interface Profile extends PublicUser {
Expand All @@ -9,5 +9,5 @@ export const profileDecoder: Decoder<Profile> = object({
username: string,
bio: nullable(string),
image: nullable(string),
following: boolean,
following: either(boolean, hardcoded(false)),
});

0 comments on commit 99498d8

Please sign in to comment.