This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/core/network/lib/src/entrance/supabase_entrance_api.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:core_network/core_network.dart'; | ||
import 'package:core_network/src/entrance/entrance_api.dart'; | ||
import 'package:supabase_flutter/supabase_flutter.dart'; | ||
|
||
final supabaseEntranceApiProvider = entranceApiProvider.overrideWith( | ||
(ref) => SupabaseEntranceApi( | ||
supabaseClient: ref.watch(supabaseClientProvider), | ||
), | ||
); | ||
|
||
/// 仮登録API を SupabaseClient で実装したクラス | ||
class SupabaseEntranceApi implements EntranceApi { | ||
static const _table = 'entrance'; | ||
|
||
final SupabaseClient _supabaseClient; | ||
|
||
SupabaseEntranceApi({required SupabaseClient supabaseClient}) | ||
: _supabaseClient = supabaseClient; | ||
|
||
@override | ||
Future<void> register(String nickname, String email) async => | ||
await _supabaseClient.from(_table).insert({ | ||
"nickname": nickname, | ||
"email": email, | ||
}); | ||
} |