Replace use of react-native-config with process.env
This commit is contained in:
1 parent
7a920343f7
commit
1d85333c83
5 files changed
+13
-18
No files matched your search
+5
-5
@@ -1,5 +1,5 @@
|
||||
EVENT_API_URL=https://studentersamfundet.no
|
||||
DUSKEN_API_URL=https://galtinn.neuf.no
|
||||
DUSKEN_FORGOT_PASSWORD_URL=https://galtinn.neuf.no/auth/password_reset/
|
||||
SENTRY_DSN=
|
||||
STRIPE_PUBLISHABLE_KEY=
|
||||
EXPO_PUBLIC_EVENT_API_URL=https://studentersamfundet.no
|
||||
EXPO_PUBLIC_DUSKEN_API_URL=https://galtinn.neuf.no
|
||||
EXPO_PUBLIC_DUSKEN_FORGOT_PASSWORD_URL=https://galtinn.neuf.no/auth/password_reset/
|
||||
EXPO_PUBLIC_SENTRY_DSN=
|
||||
EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY=
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { PersistGate } from 'redux-persist/integration/react';
|
||||
import Config from 'react-native-config';
|
||||
import { ApolloClient, HttpLink, InMemoryCache, ApolloProvider } from '@apollo/client';
|
||||
import { StripeProvider } from '@stripe/stripe-react-native';
|
||||
|
||||
@@ -9,7 +8,7 @@ import Dusken from './Dusken';
|
||||
import { store, persistor } from './reduxStore';
|
||||
|
||||
const apolloClient = new ApolloClient({
|
||||
link: new HttpLink({ uri: `${Config.DUSKEN_API_URL}/api/graphql/` }),
|
||||
link: new HttpLink({ uri: `${process.env.EXPO_PUBLIC_DUSKEN_API_URL}/api/graphql/` }),
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
|
||||
@@ -20,7 +19,7 @@ export default function App() {
|
||||
<ApolloProvider client={apolloClient}>
|
||||
{/* FIXME: Read urlScheme and merchantIdentifier from .Config */}
|
||||
<StripeProvider
|
||||
publishableKey={Config.STRIPE_PUBLISHABLE_KEY || ''}
|
||||
publishableKey={process.env.EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY || ''}
|
||||
urlScheme="no-neuf-chateau"
|
||||
merchantIdentifier="merchant.com.dusken"
|
||||
>
|
||||
|
||||
+4
-6
@@ -1,5 +1,3 @@
|
||||
import Config from 'react-native-config';
|
||||
|
||||
import {
|
||||
loginFailure,
|
||||
loginRequest,
|
||||
@@ -21,7 +19,7 @@ export function requestLogin(username, password) {
|
||||
// We are now logging in
|
||||
dispatch(loginRequest());
|
||||
|
||||
return fetchWithTimeout(`${Config.DUSKEN_API_URL}/auth/obtain-token/`, {
|
||||
return fetchWithTimeout(`${process.env.EXPO_PUBLIC_DUSKEN_API_URL}/auth/obtain-token/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -56,7 +54,7 @@ export function requestUserData(authToken) {
|
||||
// We are now fetching user data
|
||||
dispatch(userDataRequest());
|
||||
|
||||
return fetchWithTimeout(`${Config.DUSKEN_API_URL}/api/me/`, {
|
||||
return fetchWithTimeout(`${process.env.EXPO_PUBLIC_DUSKEN_API_URL}/api/me/`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -86,7 +84,7 @@ export function requestRegisterUser({ firstName, lastName, email, phoneNumber, p
|
||||
return (dispatch) => {
|
||||
dispatch(registerUserRequest());
|
||||
|
||||
return fetchWithTimeout(`${Config.DUSKEN_API_URL}/api/user/register/`, {
|
||||
return fetchWithTimeout(`${process.env.EXPO_PUBLIC_DUSKEN_API_URL}/api/user/register/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -122,7 +120,7 @@ export function requestMembershipCharge(authToken, stripeToken, membershipType)
|
||||
return (dispatch) => {
|
||||
dispatch(membershipChargeRequest());
|
||||
|
||||
return fetchWithTimeout(`${Config.DUSKEN_API_URL}/api/membership/charge/`, {
|
||||
return fetchWithTimeout(`${process.env.EXPO_PUBLIC_DUSKEN_API_URL}/api/membership/charge/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import Config from 'react-native-config';
|
||||
import moment from 'moment';
|
||||
import 'moment/locale/nb';
|
||||
|
||||
@@ -56,7 +55,7 @@ const useEventList = () => {
|
||||
};
|
||||
|
||||
const fetchEvents = async () => {
|
||||
const url = `${Config.EVENT_API_URL}/wp-json/wp/v2/events?page=${page}&future=1`;
|
||||
const url = `${process.env.EXPO_PUBLIC_EVENT_API_URL}/wp-json/wp/v2/events?page=${page}&future=1`;
|
||||
setLoading(true);
|
||||
|
||||
let eventData;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Linking, StyleSheet, View } from 'react-native';
|
||||
import { ScrollView, Spinner, Button, Text } from 'native-base';
|
||||
import Config from 'react-native-config';
|
||||
|
||||
import theme from '../../theme';
|
||||
import useLogin from './useLogin';
|
||||
@@ -44,7 +43,7 @@ const Login = () => {
|
||||
small
|
||||
light
|
||||
onPress={() => {
|
||||
Linking.openURL(Config.DUSKEN_FORGOT_PASSWORD_URL);
|
||||
Linking.openURL(process.env.EXPO_PUBLIC_DUSKEN_FORGOT_PASSWORD_URL);
|
||||
}}
|
||||
style={styles.forgotPasswordButton}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user