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) {
|
if (!session) {
|
||||||
return fail(401, { name });
|
return fail(401, { name });
|
||||||
}
|
}
|
||||||
const { error } = await supabase.from('users').update({
|
const { error } = await supabase
|
||||||
name: name,
|
.from('users')
|
||||||
}).eq('id', session?.user.id);
|
.update({
|
||||||
|
name: name
|
||||||
|
})
|
||||||
|
.eq('id', session?.user.id);
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return fail(500, {
|
return fail(500, {
|
||||||
name,
|
name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
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;
|
loading = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSignOut: SubmitFunction = () => {
|
|
||||||
loading = true;
|
|
||||||
return async ({ update }) => {
|
|
||||||
loading = false;
|
|
||||||
update();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="form-widget">
|
<div class="form-widget">
|
||||||
@@ -50,10 +42,4 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form method="post" action="?/signout" use:enhance={handleSignOut}>
|
|
||||||
<div>
|
|
||||||
<button class="button block" disabled={loading}>Sign Out</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user