feat: implement membership confirmation flow and update related functionalities
This commit is contained in:
@@ -13,14 +13,24 @@ class AuthApi {
|
||||
constructor(private readonly client: SupabaseClient<Database>) {}
|
||||
|
||||
/**
|
||||
* @name hasPersonalCode
|
||||
* @description Check if given account ID has added personal code.
|
||||
* @param id
|
||||
* @name hasUnseenMembershipConfirmation
|
||||
* @description Check if given user ID has any unseen membership confirmation.
|
||||
*/
|
||||
async hasPersonalCode(id: string) {
|
||||
const { data, error } = await this.client.rpc('has_personal_code', {
|
||||
account_id: id,
|
||||
});
|
||||
async hasUnseenMembershipConfirmation() {
|
||||
const {
|
||||
data: { user },
|
||||
} = await this.client.auth.getUser();
|
||||
|
||||
if (!user) {
|
||||
throw new Error('User not authenticated');
|
||||
}
|
||||
|
||||
const { data, error } = await this.client.rpc(
|
||||
'has_unseen_membership_confirmation',
|
||||
{
|
||||
p_user_id: user.id,
|
||||
},
|
||||
);
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user