mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 02:53:50 +00:00
chore(*): Remove redundant sign out button
This commit is contained in:
@@ -27,27 +27,23 @@ export const actions: Actions = {
|
||||
if (!session) {
|
||||
return fail(401, { name });
|
||||
}
|
||||
const { error } = await supabase.from('users').update({
|
||||
name: name,
|
||||
}).eq('id', session?.user.id);
|
||||
const { error } = await supabase
|
||||
.from('users')
|
||||
.update({
|
||||
name: name
|
||||
})
|
||||
.eq('id', session?.user.id);
|
||||
|
||||
console.error(error);
|
||||
|
||||
if (error) {
|
||||
return fail(500, {
|
||||
name,
|
||||
name
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
name
|
||||
};
|
||||
},
|
||||
signout: async ({ locals: { supabase, safeGetSession } }) => {
|
||||
const { session } = await safeGetSession();
|
||||
if (session) {
|
||||
await supabase.auth.signOut();
|
||||
redirect(303, '/');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,14 +18,6 @@
|
||||
loading = false;
|
||||
};
|
||||
};
|
||||
|
||||
const handleSignOut: SubmitFunction = () => {
|
||||
loading = true;
|
||||
return async ({ update }) => {
|
||||
loading = false;
|
||||
update();
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="form-widget">
|
||||
@@ -50,10 +42,4 @@
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="post" action="?/signout" use:enhance={handleSignOut}>
|
||||
<div>
|
||||
<button class="button block" disabled={loading}>Sign Out</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user