wip: almost there, needs dev mode sorted + loading

This commit is contained in:
Loewy
2024-02-07 15:39:11 -08:00
parent 07db6e21db
commit b9221fa949
9 changed files with 130 additions and 112 deletions

View File

@@ -1,18 +1,16 @@
import React from "react";
import { Button } from "react-native";
import { handleSignOut } from "../../auth";
import { useAuth } from "../../context";
import { useAuthHeader } from "../../graphql/client";
export default function SignOutButton(): React.JSX.Element {
const { logOut } = useAuth();
const { setAuthHeader } = useAuthHeader();
return (
<Button
title={"Sign out"}
onPress={async () => {
setAuthHeader({ key: "Authorization", value: "" });
await handleSignOut();
}}
/>
);
const handleSignOut = async () => {
await logOut();
setAuthHeader({ key: "Authorization", value: "" });
};
return <Button title={"Sign out"} onPress={handleSignOut} />;
}