Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const config = require('../config/local').default;

export const API_BASE_URL = config.API_BASE_URL;
export const AUTH_BASE_URL = config.AUTH_BASE_URL;
export const MIDTRANS_CLIENT_KEY = config.MIDTRANS_CLIENT_KEY;
export const PAYPAL_CLIENT_ID = config.PAYPAL_CLIENT_ID;
export const PAYPAL_CURRENCY = config.PAYPAL_CURRENCY;
Expand Down
45 changes: 21 additions & 24 deletions app/containers/AttendeesList/actions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
IS_TRANSFERRING_TICKET
} from './constants';

import attendees from '../../services/attendees';

/*
* Get attendees data
Expand All @@ -34,29 +35,25 @@ export function fetchingAttendeesStatus(status) {
export function fetchAttendees() {
return (dispatch) => {
dispatch(isFetchingAttendees(true));
getAccessToken()
.then((token) => {
const headers = { Authorization: token };
DevSummitAxios.get('api/v1/attendees', { headers })
.then((response) => {
if ('data' in response.data) {
if (!('message' in response.data.data)) {
dispatch(isFetchingAttendees(false));
if (response.data.data.length === 0) {
dispatch(fetchingAttendeesStatus(false));
} else {
dispatch(fetchingAttendeesStatus(response.data.meta.success));
}
}
dispatch({
type: FETCH_ATTENDEES,
payloads: response.data.data
});
}
})
.catch((err) => {
console.log(err);
});

attendees.get().then((response) => {
if ('data' in response.data) {
if (!('message' in response.data.data)) {
dispatch(isFetchingAttendees(false));
if (response.data.data.length === 0) {
dispatch(fetchingAttendeesStatus(false));
} else {
dispatch(fetchingAttendeesStatus(response.data.meta.success));
}
}
dispatch({
type: FETCH_ATTENDEES,
payloads: response.data.data
});
}
})
.catch((err) => {
console.log(err);
});
};
}
Expand All @@ -77,7 +74,7 @@ export function transferTicket(ticketId, receiverId) {
Authorization: token,
'Content-Type': 'application/json'
};
DevSummitAxios.put('api/v1/user/tickets',
DevSummitAxios.put('/user/tickets',
{
ticket_id: ticketId,
receiver_id: receiverId
Expand Down
25 changes: 11 additions & 14 deletions app/containers/BoothInfo/actions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
} from './constants';
import local from '../../../config/local';

import boothInfo from '../../services/boothInfo';

export function updateFields(field, value) {
return {
type: UPDATE_FIELD,
Expand Down Expand Up @@ -71,16 +73,12 @@ export function updateDataStorage(response) {

export function fetchBoothInfo(id) {
return (dispatch) => {
getAccessToken()
.then((token) => {
const headers = { Authorization: token };
DevSummitAxios.get('api/v1/booths/galleries/' + id, { headers })
.then(async (response) => {
await dispatch({
type: FETCH_BOOTH_INFO,
payloads: response.data
});
});
boothInfo.getPhoto(id)
.then((response) => {
dispatch({
type: FETCH_BOOTH_INFO,
payloads: response.data
});
});
dispatch(clearBoothGallery());
};
Expand All @@ -100,14 +98,14 @@ export function uploadBoothImage(image) {
name: 'image.jpg'
});

DevSummitAxios.post('/api/v1/booths/galleries', form, { headers })
boothInfo.post()
.then((response) => {
dispatch(updateBoothGallery(response.data.data[0]));
// dispatch(updateIsBoothGalleriesUpdated(true));
dispatch({
type: UPDATE_IS_BOOTH_GALLERY_UPDATED,
status: true
})
});
}).catch(err => console.log('error upload image', err));
});
};
Expand All @@ -118,7 +116,6 @@ export function updateImage(image) {
dispatch(updateIsBoothPhotoUpdated(false));
getAccessToken()
.then((token) => {

const headers = { Authorization: token };
const form = new FormData();

Expand All @@ -128,7 +125,7 @@ export function updateImage(image) {
name: 'image.jpg'
});

DevSummitAxios.patch('/api/v1/booths/updatelogo', form, { headers })
boothInfo.patch()
.then((response) => {
updateDataStorage(response.data);
dispatch(updateBoothPhoto(response.data.data.logo_url));
Expand Down
20 changes: 9 additions & 11 deletions app/containers/BoothList/actions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IS_FETCHING_BOOTHS
} from './constants';

import boothList from '../../services/boothList';
/*
* Get speaker data
*/
Expand All @@ -23,17 +24,14 @@ export function fetchBoothList() {
return (dispatch) => {
dispatch(isFetchingBooths(true));

getAccessToken()
.then((token) => {
const headers = { Authorization: token };
DevSummitAxios.get('api/v1/booths', { headers })
.then(async (response) => {
await dispatch({
type: FETCH_BOOTH_LIST,
payloads: response.data.data
});
dispatch(isFetchingBooths(false))
});
boothList
.get()
.then((response) => {
dispatch({
type: FETCH_BOOTH_LIST,
payloads: response.data.data
});
dispatch(isFetchingBooths(false));
});
};
}
52 changes: 23 additions & 29 deletions app/containers/ChangePassword/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AsyncStorage } from 'react-native';
import {
DevSummitAxios,
getAccessToken
} from '../../helpers'
} from '../../helpers';

/*
* import constants
Expand All @@ -16,7 +16,9 @@ import {
UPDATE_IS_PASSWORD_UPDATED,
UPDATE_IS_PASSWORD_WRONG,
RESET_STATE
} from './constants'
} from './constants';

import changedPassword from '../../services/changePassword';


/*
Expand All @@ -25,11 +27,11 @@ import {
* @param {value: value to be set}
*/
export function updateInputFields(field, value) {
return {
type: UPDATE_SINGLE_INPUT_FIELD,
field,
value
}
return {
type: UPDATE_SINGLE_INPUT_FIELD,
field,
value
};
}


Expand All @@ -39,11 +41,11 @@ export function updateInputFields(field, value) {
* @param {value: value to be set}
*/
export function updateErrorFields(field, value) {
return {
type: UPDATE_SINGLE_ERROR_FIELD,
field,
value
}
return {
type: UPDATE_SINGLE_ERROR_FIELD,
field,
value
};
}

export function updateIsLoading(status) {
Expand Down Expand Up @@ -79,24 +81,16 @@ export function changePassword() {
const { inputFields } = getState().get('changePassword').toJS();
const { current_password, new_password, confirm_password } = inputFields;

getAccessToken()
.then((token) => {
DevSummitAxios.patch('/auth/me/changepassword', {
old_password: current_password,
new_password
}, {
headers: {
Authorization: token
}
}).then((response) => {
if (response && response.data && response.data.meta.success) {
dispatch(updateIsPasswordUpdate(true));
} else {
dispatch(updateIsPasswordWrong(true));
}
changedPassword.patch({old_password: current_password,
new_password})
.then((response) => {
if (response && response.data && response.data.meta.success) {
dispatch(updateIsPasswordUpdate(true));
} else {
dispatch(updateIsPasswordWrong(true));
}

dispatch(updateIsLoading(false));
});
dispatch(updateIsLoading(false));
});
};
}
5 changes: 2 additions & 3 deletions app/containers/Feed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ import * as actions from './actions';
import * as selectors from './selectors';
import OrderList from '../OrderList';
import Redeem from '../Redeem';
import { PRIMARYCOLOR } from '../../constants';
import { API_BASE_URL } from '../../constants';
import { PRIMARYCOLOR, AUTH_BASE_URL } from '../../constants';
import { CONTENT_REPORT, TWITTER_ICON, FACEBOOK_ICON, WHATSAPP_ICON } from './constants';
import { isConfirm } from '../../helpers';
import { getIsConfirmEmail } from '../OrderList/selectors';

const socket = openSocket(API_BASE_URL);
const socket = openSocket(AUTH_BASE_URL);
const noFeeds = require('./../../../assets/images/nofeed.png');

function subscribeToFeeds(cb) {
Expand Down
12 changes: 7 additions & 5 deletions app/containers/Main/actions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import OAuthManager from 'react-native-oauth';
import { twitter } from 'react-native-simple-auth';
import { Actions } from 'react-native-router-flux';
import axios from 'axios';
import auth from '../../services/auth';

import { DevSummitAxios } from '../../helpers';

Expand All @@ -27,6 +28,10 @@ import {
TWITTER_CONSUMER_KEY_SECRET
} from './constants';

const Auth = axios.create({
baseURL: 'http://api.devsummit.io:8081'
});

/*
* Update the input fields
* @param {field: name of the field}
Expand Down Expand Up @@ -94,10 +99,7 @@ export function login() {
const { username, password } = fields;

dispatch(updateisLoading(true));
DevSummitAxios.post('/auth/login', {
username,
password
})
auth.post(username, password, Auth)
.then(async (response) => {
if (response && response.data && response.data.meta.success) {
const resData = response.data.data;
Expand Down Expand Up @@ -431,7 +433,7 @@ export function subscribeNewsletter() {
const { email } = fields;

const headers = { 'Content-Type': 'application/json' };
DevSummitAxios.post('/api/v1/newsletters', { email }, { headers }).then((response) => {
DevSummitAxios.post('/newsletters', { email }, { headers }).then((response) => {
if (response && response.data && response.data.meta.success) {
dispatch(updateIsSubscribed(true));
}
Expand Down
Loading