Files
absensi_sas_flutter/lib/provider/graphql_provider.dart

23 lines
553 B
Dart

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:graphql/client.dart';
import '../app/constant.dart';
final graphqlProvider = Provider.family<GraphQLClient, String>(
(_, token) {
return GraphQLClient(
link: (token != "")
? HttpLink(
Constant.baseURLGraphQl,
defaultHeaders: {
'Authorization': 'Bearer $token',
},
)
: HttpLink(
Constant.baseURLGraphQl,
),
cache: GraphQLCache(),
);
},
);