Skip to content

Commit

Permalink
little debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas-github-acc committed Jul 24, 2024
1 parent 4926a31 commit 3aa5f03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions src/app/auth/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ export const AuthSignIn = async () => {
return { error: 'Error signing in', url: null };
}

export async function usernameExisits(username: string): Promise<boolean> {
const supabase = createClient();
let { data, error } = await supabase
.rpc('is_username_exist', {
username: username,
});
if (error) console.error(error)
return data;
}

export const checkEmailForOrganisation = (
credentials : {
email: string ,
Expand Down
6 changes: 3 additions & 3 deletions src/app/auth/component/component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FormEvent, use, useEffect, useState } from "react";
import { usernameExisits } from "@/app/auth/action";
import axios from "axios";

import { Label } from "@/components/ui/label"
import { Input } from "@/components/ui/input"
Expand Down Expand Up @@ -90,9 +90,9 @@ export function Component( props : Props) {
return ;
}
setLoading(true);
const data = await usernameExisits(username)
const res = await axios.post('/api/rest/v1/isUsername', {username: username});

if (data) {
if (res.data.state) {
const nextUserSibling = current.username.nextElementSibling as HTMLElement;
nextUserSibling.innerText = 'Username already exists';
} else {
Expand Down

0 comments on commit 3aa5f03

Please sign in to comment.