From 2c01bf05fa4c56b7431cff50b353c22672ecf838 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 5 May 2016 18:25:45 +0100 Subject: [PATCH] Store token key in constants --- app/api/token.js | 9 ++++----- app/settings/constants.js | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/api/token.js b/app/api/token.js index d33594e..7f5c8c7 100644 --- a/app/api/token.js +++ b/app/api/token.js @@ -1,13 +1,12 @@ import { AsyncStorage } from 'react-native'; - -const STORAGE_KEY = 'CIRCLE_TOKEN'; +import settings from '../settings/constants'; async function get() { - return await AsyncStorage.getItem(STORAGE_KEY); + return await AsyncStorage.getItem(settings.get('STORAGE_KEY')); } async function set(token) { - return await AsyncStorage.setItem(STORAGE_KEY, token); + return await AsyncStorage.setItem(settings.get('STORAGE_KEY'), token); } -export default { get, set}; +export default { get, set }; diff --git a/app/settings/constants.js b/app/settings/constants.js index 73ed28d..a7ffe0f 100644 --- a/app/settings/constants.js +++ b/app/settings/constants.js @@ -4,5 +4,6 @@ export default Map({ PROJECT_DATA: { repository: 'https://github.com/RealOrangeOne/Sphere', CI_Badge: 'https://circleci.com/gh/RealOrangeOne/Sphere.svg?style=svg' - } + }, + STORAGE_KEY: 'CIRCLE_TOKEN' });