Skip to content

Commit

Permalink
fix: Env Variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rajarsheechatterjee committed Jul 3, 2023
1 parent 0e131c0 commit 0d4e165
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 67 deletions.
8 changes: 8 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ module.exports = function (api) {
},
],
'react-native-reanimated/plugin',
[
'module:react-native-dotenv',
{
envName: 'APP_ENV',
moduleName: '@env',
path: '.env',
},
],
],
};
};
4 changes: 4 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '@env' {
export const MYANIMELIST_CLIENT_ID: string;
export const ANILIST_CLIENT_ID: string;
}
112 changes: 47 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"react-native": "^0.69.9",
"react-native-background-actions": "^2.6.5",
"react-native-device-info": "^8.4.7",
"react-native-dotenv": "^3.4.9",
"react-native-easing-gradient": "^1.0.0",
"react-native-error-boundary": "^1.1.16",
"react-native-fast-image": "^8.5.11",
Expand Down
3 changes: 2 additions & 1 deletion src/services/Trackers/aniList.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as Linking from 'expo-linking';
import * as WebBrowser from 'expo-web-browser';
import { ANILIST_CLIENT_ID } from '@env';
import {
createTracker,
type AuthenticationResult,
type Tracker,
} from './index';

const apiEndpoint = 'https://graphql.anilist.co';
const clientId = process.env.ANILIST_CLIENT_ID;
const clientId = ANILIST_CLIENT_ID;
const authUrl = `https://anilist.co/api/v2/oauth/authorize?client_id=${clientId}&response_type=token`;
const redirectUri = Linking.createURL('');
const searchQuery = `query($search: String) {
Expand Down
3 changes: 2 additions & 1 deletion src/services/Trackers/myAnimeList.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as Linking from 'expo-linking';
import * as WebBrowser from 'expo-web-browser';
import qs from 'qs';
import { MYANIMELIST_CLIENT_ID } from '@env';
import { createTracker, type UserListStatus } from './index';

const clientId = process.env.MYANIMELIST_CLIENT_ID;
const clientId = MYANIMELIST_CLIENT_ID;
const baseOAuthUrl = 'https://myanimelist.net/v1/oauth2/authorize';
const tokenUrl = 'https://myanimelist.net/v1/oauth2/token';
const baseApiUrl = 'https://api.myanimelist.net/v2';
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@utils/*": ["src/utils/*"]
}
},
"typeRoots": ["./types"],
"exclude": [
"node_modules",
"babel.config.js",
Expand Down

0 comments on commit 0d4e165

Please sign in to comment.