Skip to content

Commit a6b98be

Browse files
committed
1. 删除原AsyncStorage的引用
1 parent 45241f3 commit a6b98be

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/pages/Login/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import React from 'react';
7-
import { StyleSheet, Text, View, ScrollView, TextInput, TouchableOpacity, AsyncStorage } from 'react-native';
7+
import { StyleSheet, Text, View, ScrollView, TextInput, TouchableOpacity } from 'react-native';
88

99
import { Button, GradientButton } from '../../components';
1010
import BaseContainer from '../../components/BaseContainer';

app/utils/Request/Fetch.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type ErrorType = {
1313
[key: string]: any
1414
};
1515

16-
type MethodType = 'GET' | 'POST' | 'DELETE' | 'PUT' | 'get' | 'post' | 'delete' | 'put' | string;
16+
type MethodType = string | 'GET' | 'POST' | 'DELETE' | 'PUT' | 'get' | 'post' | 'delete' | 'put' ;
1717

1818
// 处理url
1919
function encodeQuery(url: string, params: Object = {}) {
@@ -82,7 +82,7 @@ class Fetch {
8282
*
8383
*/
8484
static fetch<T>({
85-
method,
85+
method = 'GET',
8686
url,
8787
params = {},
8888
config = {},
@@ -94,7 +94,6 @@ class Fetch {
9494
config: Object,
9595
headers: RTBody
9696
}): Promise<T> {
97-
let _method: string | any;
9897
let _params;
9998
let _url = url;
10099
const _config = {
@@ -111,8 +110,8 @@ class Fetch {
111110

112111
// let userData = await AsyncStorage.getItem('USER_TOKEN');
113112

114-
if (!method) _method = 'GET';
115-
else _method = method.toUpperCase();
113+
114+
const _method: any = method.toUpperCase();
116115

117116
if (_method === 'GET' && params) {
118117
_url = encodeQuery(_url, params);

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ YellowBox.ignoreWarnings([
3232
'Warning: Expected instance props to match',
3333
'Warning: ViewPagerAndroid has been extracted from react-native core and will be removed in a future release.',
3434
'Warning: Slider has been extracted from react-native core and will be removed in a future release.',
35+
'Warning: Async Storage has been extracted from react-native core and will be removed in a future release.'
3536
]);
3637

3738
// console.ignoredYellowBox = [ 'Warning: isMounted(...)', 'Require cycle: app/utils'];

0 commit comments

Comments
 (0)