Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
✨ 仮登録のsupabaseクラス作成(#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
chippy-ao committed Apr 5, 2023
1 parent ac71917 commit cdcab75
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/core/network/lib/src/entrance/supabase_entrance_api.dart
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,
});
}

0 comments on commit cdcab75

Please sign in to comment.