update: login function and purchased item store
This commit is contained in:
parent
02c17264b7
commit
d7b2b8fdd1
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -6433,11 +6433,13 @@
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true
|
"bundled": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
|
@ -6454,7 +6456,8 @@
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true
|
"bundled": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -6561,7 +6564,8 @@
|
||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true
|
"bundled": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
|
@ -6583,6 +6587,7 @@
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,11 @@ export default class App extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// this.checkIsLogin();
|
// this.checkIsLogin();
|
||||||
// this.settingStore.getAll();
|
// this.settingStore.getAll();
|
||||||
// this.authStore.getProfile();
|
this.authStore.getProfile();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(this.authStore.userProfile, 'this.authStore.userProfile this.authStore.userProfile');
|
||||||
|
}, 2500)
|
||||||
// this.user.getUserGeolocation();
|
// this.user.getUserGeolocation();
|
||||||
// this.appStore.getAppType();
|
// this.appStore.getAppType();
|
||||||
// this.profileStore.getProfile();
|
// this.profileStore.getProfile();
|
||||||
|
|
|
@ -103,7 +103,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
name: 'KFC',
|
name: 'KFC',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/kfc-box_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/kfc-box_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'KFC merupakan restoran cepat saji yang menyediakan ayam goreng serta berbagai menu pilihan lainnya seperti burger, sup, dan salad. Dengan rasa yang renyah dan gurih, siapa pun dijamin ketagihan dengan ayam goreng yang satu ini.',
|
description: 'KFC merupakan restoran cepat saji yang menyediakan ayam goreng serta berbagai menu pilihan lainnya seperti burger, sup, dan salad. Dengan rasa yang renyah dan gurih, siapa pun dijamin ketagihan dengan ayam goreng yang satu ini.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
||||||
background_color: 'linear-gradient(rgb(214, 18, 53), rgb(100, 23, 24))',
|
background_color: 'linear-gradient(rgb(214, 18, 53), rgb(100, 23, 24))',
|
||||||
|
@ -128,7 +130,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Grab',
|
name: 'Grab',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/grab_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/grab_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'Grab adalah platform transportasi terkemuka di Asia Tenggara. Kami percaya setiap orang harus bisa pergi ke mana saja dan percaya bahwa mereka dapat memesan perjalanan yang aman.',
|
description: 'Grab adalah platform transportasi terkemuka di Asia Tenggara. Kami percaya setiap orang harus bisa pergi ke mana saja dan percaya bahwa mereka dapat memesan perjalanan yang aman.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 28 Februari 2019. Voucher ini hanya bisa digunakan untuk layanan GrabCar, GrabBike, dan GrabExpress. ',
|
additional_information: 'Voucher ini berlaku hingga 28 Februari 2019. Voucher ini hanya bisa digunakan untuk layanan GrabCar, GrabBike, dan GrabExpress. ',
|
||||||
background_color: 'linear-gradient(rgb(0, 174, 66), rgb(0, 93, 36))',
|
background_color: 'linear-gradient(rgb(0, 174, 66), rgb(0, 93, 36))',
|
||||||
|
@ -153,7 +157,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'OYO Hotel',
|
name: 'OYO Hotel',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/oyo_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/oyo_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'OYO Hotel adalah jaringan hotel terbesar di Asia Selatan dan terdapat di 11 negara dengan lebih dari 12,000 hotel tersebar di seluruh dunia.',
|
description: 'OYO Hotel adalah jaringan hotel terbesar di Asia Selatan dan terdapat di 11 negara dengan lebih dari 12,000 hotel tersebar di seluruh dunia.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 31 Januari 2019.',
|
additional_information: 'Voucher ini berlaku hingga 31 Januari 2019.',
|
||||||
background_color: 'linear-gradient(rgb(253, 234, 225), rgb(255, 138, 98))',
|
background_color: 'linear-gradient(rgb(253, 234, 225), rgb(255, 138, 98))',
|
||||||
|
@ -166,7 +172,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Carrefour',
|
name: 'Carrefour',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/carrefour_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/carrefour_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'Carrefour membantu semua orang agar dapat menikmati kualitas hidup yang lebih baik setiap harinya. Menyediakan berbagai kebutuhan harian sekaligus bulanan, sebagai tujuan utama berbelanja keluarga dengan memberikan pelayanan dan produk berkualitas dimanapun dan kapanpun.',
|
description: 'Carrefour membantu semua orang agar dapat menikmati kualitas hidup yang lebih baik setiap harinya. Menyediakan berbagai kebutuhan harian sekaligus bulanan, sebagai tujuan utama berbelanja keluarga dengan memberikan pelayanan dan produk berkualitas dimanapun dan kapanpun.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
||||||
background_color: 'linear-gradient(rgb(236, 249, 250), rgb(73, 176, 228))',
|
background_color: 'linear-gradient(rgb(236, 249, 250), rgb(73, 176, 228))',
|
||||||
|
@ -183,7 +191,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Domino's Pizza",
|
name: "Domino's Pizza",
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/dominos_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/dominos_150px_74px.png'
|
||||||
|
},
|
||||||
description: "Domino's Pizza adalah pemimpin Pizza delivery di dunia. Dengan 130 toko yang tersebar di Jabodetabek, Bali, Bandung, Serang, dan Sukabumi, Domino’s menyajikan pizza paling lezat dengan harga terbaik untuk jutaan pelanggan. Domino’s juga mengantarkan pizza hangat dengan jaminan 30 menit sampai.",
|
description: "Domino's Pizza adalah pemimpin Pizza delivery di dunia. Dengan 130 toko yang tersebar di Jabodetabek, Bali, Bandung, Serang, dan Sukabumi, Domino’s menyajikan pizza paling lezat dengan harga terbaik untuk jutaan pelanggan. Domino’s juga mengantarkan pizza hangat dengan jaminan 30 menit sampai.",
|
||||||
additional_information: "Voucher ini berlaku hingga 29 hari setelah pembelian",
|
additional_information: "Voucher ini berlaku hingga 29 hari setelah pembelian",
|
||||||
background_color: 'linear-gradient(rgb(11, 110, 174), rgb(2, 61, 96))',
|
background_color: 'linear-gradient(rgb(11, 110, 174), rgb(2, 61, 96))',
|
||||||
|
@ -200,7 +210,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Timezone',
|
name: 'Timezone',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/new-timezone_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/new-timezone_150px_74px.png',
|
||||||
|
},
|
||||||
description: 'Timezone merupakan tempat permainan semua keluarga di Indonesia. Beragam permainan menarik yang disediakan untuk memberikan pengalaman yang menyenangkan bagi setiap pengunjung. Selain permainan – permainan yang cukup menarik dan sensasi berbeda, pengunjung yang hadir ke Timezone juga berkesempatan mendapatkan hadiah-hadiah menarik dari mesin-mesin yang dimainkan ataupun souvenir, boneka dari tiket yang ditukarkan',
|
description: 'Timezone merupakan tempat permainan semua keluarga di Indonesia. Beragam permainan menarik yang disediakan untuk memberikan pengalaman yang menyenangkan bagi setiap pengunjung. Selain permainan – permainan yang cukup menarik dan sensasi berbeda, pengunjung yang hadir ke Timezone juga berkesempatan mendapatkan hadiah-hadiah menarik dari mesin-mesin yang dimainkan ataupun souvenir, boneka dari tiket yang ditukarkan',
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
||||||
background_color: 'linear-gradient(rgb(255, 118, 90), rgb(255, 40, 12))',
|
background_color: 'linear-gradient(rgb(255, 118, 90), rgb(255, 40, 12))',
|
||||||
|
@ -217,7 +229,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Bakmi GM',
|
name: 'Bakmi GM',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/bakmigm_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/bakmigm_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'BAKMI GM dirancang khusus untuk memberikan rasa yang lezat, yang dibuat dari bahan baku pilihan dan disajikan dengan harga yang ekonomis. Tersedia lebih dari 50 menu yang dapat dipilih oleh pelanggan, dengan menu Bakmi Special GM dan Pangsit Goreng yang menjadi favorit pelanggan.',
|
description: 'BAKMI GM dirancang khusus untuk memberikan rasa yang lezat, yang dibuat dari bahan baku pilihan dan disajikan dengan harga yang ekonomis. Tersedia lebih dari 50 menu yang dapat dipilih oleh pelanggan, dengan menu Bakmi Special GM dan Pangsit Goreng yang menjadi favorit pelanggan.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 11 Januari 2019.',
|
additional_information: 'Voucher ini berlaku hingga 11 Januari 2019.',
|
||||||
background_color: 'linear-gradient(rgb(254, 239, 73), rgb(241, 186, 54))',
|
background_color: 'linear-gradient(rgb(254, 239, 73), rgb(241, 186, 54))',
|
||||||
|
@ -234,7 +248,9 @@ export default class DashboardComponent extends React.Component {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'CFC',
|
name: 'CFC',
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/cfc_150px_74px.png',
|
images: {
|
||||||
|
logo: 'https://ecs7.tokopedia.net/img/recharge/operator/cfc_150px_74px.png'
|
||||||
|
},
|
||||||
description: 'CFC merupakan salah satu brand fast food yang tersebar di berbagai daerah di Indonesia. CFC menyediakan berbagai menu makanan dan minuman yang praktis dan bervariasi sesuai dengan selera keluarga Indonesia. Mulai dari berbagai menu berbahan dasar ayam seperti : Crispy Fried Chicken, Chicken Strips, Chicken Pop, Chicken Burger, Ayam Geprek, hingga Nasi Goreng, Spaghetti, Ice blended, Calblend Float, dan masih banyak lagi.',
|
description: 'CFC merupakan salah satu brand fast food yang tersebar di berbagai daerah di Indonesia. CFC menyediakan berbagai menu makanan dan minuman yang praktis dan bervariasi sesuai dengan selera keluarga Indonesia. Mulai dari berbagai menu berbahan dasar ayam seperti : Crispy Fried Chicken, Chicken Strips, Chicken Pop, Chicken Burger, Ayam Geprek, hingga Nasi Goreng, Spaghetti, Ice blended, Calblend Float, dan masih banyak lagi.',
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian. Maksimal penggunaan 3 e-Voucher dalam 1 kali transaksi',
|
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian. Maksimal penggunaan 3 e-Voucher dalam 1 kali transaksi',
|
||||||
background_color: 'linear-gradient(rgb(255, 255, 255), rgb(192, 192, 192))',
|
background_color: 'linear-gradient(rgb(255, 255, 255), rgb(192, 192, 192))',
|
||||||
|
@ -315,13 +331,13 @@ export default class DashboardComponent extends React.Component {
|
||||||
})}
|
})}
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<ModalVouchersComponent
|
{/*<ModalVouchersComponent*/}
|
||||||
title={this.state.data.name+' Vouchers'}
|
{/*title={this.state.data.name+' Vouchers'}*/}
|
||||||
data={this.state.data}
|
{/*data={this.state.data}*/}
|
||||||
isVisible={this.state.isOpened}
|
{/*isVisible={this.state.isOpened}*/}
|
||||||
onOk={() => this.setState({isOpened: false})}
|
{/*onOk={() => this.setState({isOpened: false})}*/}
|
||||||
onCancel={() => this.setState({isOpened: false})}
|
{/*onCancel={() => this.setState({isOpened: false})}*/}
|
||||||
/>
|
{/*/>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,16 +12,31 @@ export default class LoginComponent extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.props = props;
|
this.props = props;
|
||||||
this.state = {
|
this.state = {
|
||||||
email: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
};
|
};
|
||||||
this.defaultState = Object.assign({}, this.state);
|
this.defaultState = Object.assign({}, this.state);
|
||||||
|
this.authStore = props.appstate.auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
login = () => {
|
||||||
|
const username = this.state.username;
|
||||||
|
const password = this.state.password;
|
||||||
|
const data = {
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
}
|
||||||
|
this.authStore.login(data).then(res => {
|
||||||
|
this.props.history.push(LINKS.DASHBOARD);
|
||||||
|
}).catch(err => {
|
||||||
|
alert(err.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -35,15 +50,17 @@ export default class LoginComponent extends React.Component {
|
||||||
<input
|
<input
|
||||||
className={'usernameForm'}
|
className={'usernameForm'}
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
|
onChange={(e) => this.setState({username: e.target.value})}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
className={'passwordForm'}
|
className={'passwordForm'}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
|
onChange={(e) => this.setState({password: e.target.value})}
|
||||||
type="password"
|
type="password"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button onClick={() => this.props.history.push(LINKS.DASHBOARD)} className={'buttonLogin'}>
|
<button onClick={() => this.login()} className={'buttonLogin'}>
|
||||||
Sign In
|
Sign In
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,10 +28,16 @@ export class ItemCard extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {data = {}} = this.props;
|
const {data = {}} = this.props;
|
||||||
|
let image = ''
|
||||||
|
if(data.images.logo.includes('http')){
|
||||||
|
image = data.images.logo;
|
||||||
|
}else{
|
||||||
|
image = this.http.appendImagePath(data.images.logo);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={'itemCard'}>
|
<Card className={'itemCard'}>
|
||||||
<img className={'imageCard'} src={this.http.appendImagePath(data.images.logo)} />
|
<img className={'imageCard'} src={image} />
|
||||||
<p className={'titleCard'}>{data.name}</p>
|
<p className={'titleCard'}>{data.name}</p>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,7 +24,13 @@ export default class ModalVouchersComponent extends React.Component {
|
||||||
componentDidMount() {}
|
componentDidMount() {}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {data, isVisible = false, onOk = () => {}, onCancel = () => {}, title='Modal'} = this.props;
|
const {data = {}, isVisible = false, onOk = () => {}, onCancel = () => {}, title='Modal'} = this.props;
|
||||||
|
let image = ''
|
||||||
|
if(data.images.logo.includes('http')){
|
||||||
|
image = data.images.logo;
|
||||||
|
}else{
|
||||||
|
image = this.http.appendImagePath(data.images.logo);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -52,7 +58,7 @@ export default class ModalVouchersComponent extends React.Component {
|
||||||
// background: data.background_color || '#aaa',
|
// background: data.background_color || '#aaa',
|
||||||
flex: 0.3
|
flex: 0.3
|
||||||
}}>
|
}}>
|
||||||
<img className={'imageModal'} src={this.http.appendImagePath(data.images.logo)} />
|
<img className={'imageModal'} src={image} />
|
||||||
<p className={'titleModal'}>{data.name} }</p>
|
<p className={'titleModal'}>{data.name} }</p>
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
|
|
|
@ -52,152 +52,6 @@ export default class VouchersComponent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const data = [
|
|
||||||
{
|
|
||||||
name: 'KFC',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/kfc-box_150px_74px.png',
|
|
||||||
description: 'KFC merupakan restoran cepat saji yang menyediakan ayam goreng serta berbagai menu pilihan lainnya seperti burger, sup, dan salad. Dengan rasa yang renyah dan gurih, siapa pun dijamin ketagihan dengan ayam goreng yang satu ini.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
|
||||||
background_color: 'linear-gradient(rgb(214, 18, 53), rgb(100, 23, 24))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 50.000',
|
|
||||||
cost: '50 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 100.000',
|
|
||||||
cost: '100 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Super Besar 1',
|
|
||||||
cost: '34 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Super Besar 2',
|
|
||||||
cost: '49 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Grab',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/grab_150px_74px.png',
|
|
||||||
description: 'Grab adalah platform transportasi terkemuka di Asia Tenggara. Kami percaya setiap orang harus bisa pergi ke mana saja dan percaya bahwa mereka dapat memesan perjalanan yang aman.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 28 Februari 2019. Voucher ini hanya bisa digunakan untuk layanan GrabCar, GrabBike, dan GrabExpress. ',
|
|
||||||
background_color: 'linear-gradient(rgb(0, 174, 66), rgb(0, 93, 36))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 10.000',
|
|
||||||
cost: '10 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 20.000',
|
|
||||||
cost: '20 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 50.000',
|
|
||||||
cost: '50 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 100.000',
|
|
||||||
cost: '100 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'OYO Hotel',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/oyo_150px_74px.png',
|
|
||||||
description: 'OYO Hotel adalah jaringan hotel terbesar di Asia Selatan dan terdapat di 11 negara dengan lebih dari 12,000 hotel tersebar di seluruh dunia.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 31 Januari 2019.',
|
|
||||||
background_color: 'linear-gradient(rgb(253, 234, 225), rgb(255, 138, 98))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 75.000',
|
|
||||||
cost: '25 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Carrefour',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/carrefour_150px_74px.png',
|
|
||||||
description: 'Carrefour membantu semua orang agar dapat menikmati kualitas hidup yang lebih baik setiap harinya. Menyediakan berbagai kebutuhan harian sekaligus bulanan, sebagai tujuan utama berbelanja keluarga dengan memberikan pelayanan dan produk berkualitas dimanapun dan kapanpun.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
|
||||||
background_color: 'linear-gradient(rgb(236, 249, 250), rgb(73, 176, 228))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 100.000',
|
|
||||||
cost: '100 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 200.000',
|
|
||||||
cost: '200 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Domino's Pizza",
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/dominos_150px_74px.png',
|
|
||||||
description: "Domino's Pizza adalah pemimpin Pizza delivery di dunia. Dengan 130 toko yang tersebar di Jabodetabek, Bali, Bandung, Serang, dan Sukabumi, Domino’s menyajikan pizza paling lezat dengan harga terbaik untuk jutaan pelanggan. Domino’s juga mengantarkan pizza hangat dengan jaminan 30 menit sampai.",
|
|
||||||
additional_information: "Voucher ini berlaku hingga 29 hari setelah pembelian",
|
|
||||||
background_color: 'linear-gradient(rgb(11, 110, 174), rgb(2, 61, 96))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 100.000',
|
|
||||||
cost: '90 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 200.000',
|
|
||||||
cost: '180 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Timezone',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/new-timezone_150px_74px.png',
|
|
||||||
description: 'Timezone merupakan tempat permainan semua keluarga di Indonesia. Beragam permainan menarik yang disediakan untuk memberikan pengalaman yang menyenangkan bagi setiap pengunjung. Selain permainan – permainan yang cukup menarik dan sensasi berbeda, pengunjung yang hadir ke Timezone juga berkesempatan mendapatkan hadiah-hadiah menarik dari mesin-mesin yang dimainkan ataupun souvenir, boneka dari tiket yang ditukarkan',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian.',
|
|
||||||
background_color: 'linear-gradient(rgb(255, 118, 90), rgb(255, 40, 12))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Value Voucher Rp 200.000 (Saldo Rp 150.000 & Free Games Rp 50.000)',
|
|
||||||
cost: '135 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Value Voucher Rp 500.000 (Saldo Rp 300.000 & Free Games Rp 200.000)',
|
|
||||||
cost: '285 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Bakmi GM',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/bakmigm_150px_74px.png',
|
|
||||||
description: 'BAKMI GM dirancang khusus untuk memberikan rasa yang lezat, yang dibuat dari bahan baku pilihan dan disajikan dengan harga yang ekonomis. Tersedia lebih dari 50 menu yang dapat dipilih oleh pelanggan, dengan menu Bakmi Special GM dan Pangsit Goreng yang menjadi favorit pelanggan.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 11 Januari 2019.',
|
|
||||||
background_color: 'linear-gradient(rgb(254, 239, 73), rgb(241, 186, 54))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 50.000',
|
|
||||||
cost: '47 Points'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'Rp. 100.000',
|
|
||||||
cost: '94 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CFC',
|
|
||||||
image: 'https://ecs7.tokopedia.net/img/recharge/operator/cfc_150px_74px.png',
|
|
||||||
description: 'CFC merupakan salah satu brand fast food yang tersebar di berbagai daerah di Indonesia. CFC menyediakan berbagai menu makanan dan minuman yang praktis dan bervariasi sesuai dengan selera keluarga Indonesia. Mulai dari berbagai menu berbahan dasar ayam seperti : Crispy Fried Chicken, Chicken Strips, Chicken Pop, Chicken Burger, Ayam Geprek, hingga Nasi Goreng, Spaghetti, Ice blended, Calblend Float, dan masih banyak lagi.',
|
|
||||||
additional_information: 'Voucher ini berlaku hingga 29 hari setelah pembelian. Maksimal penggunaan 3 e-Voucher dalam 1 kali transaksi',
|
|
||||||
background_color: 'linear-gradient(rgb(255, 255, 255), rgb(192, 192, 192))',
|
|
||||||
option: [
|
|
||||||
{
|
|
||||||
value: 'Rp. 50.000',
|
|
||||||
cost: '44 Points'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="voucher">
|
<div className="voucher">
|
||||||
|
|
|
@ -49,9 +49,13 @@ export default class WalletComponent extends React.Component {
|
||||||
};
|
};
|
||||||
this.defaultState = Object.assign({}, this.state);
|
this.defaultState = Object.assign({}, this.state);
|
||||||
this.http = props.appstate.http;
|
this.http = props.appstate.http;
|
||||||
|
this.purchasedItemStore = props.appstate.purchased_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.purchasedItemStore.getAll().then(res => {
|
||||||
|
console.log(res, 'ini purchased items')
|
||||||
|
})
|
||||||
// this.globalUI.openLoading();
|
// this.globalUI.openLoading();
|
||||||
// this.transactionStore.getAll().then(res => {
|
// this.transactionStore.getAll().then(res => {
|
||||||
// this.globalUI.closeLoading();
|
// this.globalUI.closeLoading();
|
||||||
|
|
|
@ -152,7 +152,7 @@ export default class Routes extends React.Component {
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path={LINKS.ROOT} render={props => (<Redirect
|
<Route exact path={LINKS.ROOT} render={props => (<Redirect
|
||||||
to={{
|
to={{
|
||||||
pathname: true ? LINKS.DASHBOARD : LINKS.LOGIN
|
pathname: this.authStore.isLoggedIn ? LINKS.DASHBOARD : LINKS.LOGIN
|
||||||
}}/>)}/>
|
}}/>)}/>
|
||||||
<Route exact path={LINKS.REGISTER} component={RegisterComponent}/>
|
<Route exact path={LINKS.REGISTER} component={RegisterComponent}/>
|
||||||
<Route exact path={LINKS.LOGIN} component={LoginComponent}/>
|
<Route exact path={LINKS.LOGIN} component={LoginComponent}/>
|
||||||
|
|
|
@ -57,6 +57,7 @@ import Surf from './surf';
|
||||||
import Odoo from './odoo';
|
import Odoo from './odoo';
|
||||||
|
|
||||||
import Vouchers from './vouchers';
|
import Vouchers from './vouchers';
|
||||||
|
import {PurchasedItemStore} from "./purchased_item";
|
||||||
|
|
||||||
export default class AppState {
|
export default class AppState {
|
||||||
http = new Http(this.token);
|
http = new Http(this.token);
|
||||||
|
@ -115,7 +116,7 @@ export default class AppState {
|
||||||
notification = new Notification(this);
|
notification = new Notification(this);
|
||||||
tags = new Tags(this);
|
tags = new Tags(this);
|
||||||
surf_turf = new Surf(this);
|
surf_turf = new Surf(this);
|
||||||
|
purchased_items = new PurchasedItemStore(this);
|
||||||
|
|
||||||
constructor(initialState) {
|
constructor(initialState) {
|
||||||
this.token = initialState.token;
|
this.token = initialState.token;
|
||||||
|
|
|
@ -71,29 +71,31 @@ export class Authentication {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
logout() {
|
logout() {
|
||||||
return this.http.post("authentication/logout", {token : localStorage.getItem('tokens')})
|
this.context.setToken("");
|
||||||
.then(res => {
|
this.context.setUserData({});
|
||||||
this.context.setToken("");
|
// return this.http.post("authentication/logout", {token : localStorage.getItem('tokens')})
|
||||||
this.context.setUserData({});
|
// .then(res => {
|
||||||
|
// this.context.setToken("");
|
||||||
localStorage.removeItem('id_token');
|
// this.context.setUserData({});
|
||||||
localStorage.removeItem('user.name');
|
//
|
||||||
localStorage.removeItem('user.profile_image');
|
// localStorage.removeItem('id_token');
|
||||||
localStorage.setItem('isLoggingIn', false);
|
// localStorage.removeItem('user.name');
|
||||||
let cookies = document.cookie.split(";");
|
// localStorage.removeItem('user.profile_image');
|
||||||
for (let i = 0; i < cookies.length; i++) {
|
// localStorage.setItem('isLoggingIn', false);
|
||||||
this.eraseCookie(cookies[i].split("=")[0]);
|
// let cookies = document.cookie.split(";");
|
||||||
}
|
// for (let i = 0; i < cookies.length; i++) {
|
||||||
|
// this.eraseCookie(cookies[i].split("=")[0]);
|
||||||
if (window && window.Tawk_API && window.Tawk_API.isChatHidden()) {
|
// }
|
||||||
window.Tawk_API.hideWidget()
|
//
|
||||||
}
|
// if (window && window.Tawk_API && window.Tawk_API.isChatHidden()) {
|
||||||
|
// window.Tawk_API.hideWidget()
|
||||||
return res;
|
// }
|
||||||
})
|
//
|
||||||
.catch(err => {
|
// return res;
|
||||||
throw err;
|
// })
|
||||||
})
|
// .catch(err => {
|
||||||
|
// throw err;
|
||||||
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +250,7 @@ export class Authentication {
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
get isLoggedIn() {
|
get isLoggedIn() {
|
||||||
|
// alert(!!(this.context.token));
|
||||||
return !!(this.context.token);
|
return !!(this.context.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
src/common/stores/purchased_item.js
Normal file
11
src/common/stores/purchased_item.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { BaseStore } from "./base_store";
|
||||||
|
import {observable, action} from "mobx/lib/mobx";
|
||||||
|
|
||||||
|
export class PurchasedItemStore extends BaseStore {
|
||||||
|
|
||||||
|
constructor(context) {
|
||||||
|
super(context);
|
||||||
|
this.url = "purchased_items";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user