This commit is contained in:
@@ -8,7 +8,7 @@ import { useSession, signOut, updateUser } from '../lib/auth-client';
|
|||||||
import { validatePhoneOrEmail } from '../lib/validators';
|
import { validatePhoneOrEmail } from '../lib/validators';
|
||||||
|
|
||||||
export function ProfileSettings() {
|
export function ProfileSettings() {
|
||||||
const { data: session, refetch: refetchSession } = useSession();
|
const { data: session } = useSession();
|
||||||
const [userName, setUserName] = useState('');
|
const [userName, setUserName] = useState('');
|
||||||
const [savingName, setSavingName] = useState(false);
|
const [savingName, setSavingName] = useState(false);
|
||||||
const [nameSaved, setNameSaved] = useState(false);
|
const [nameSaved, setNameSaved] = useState(false);
|
||||||
@@ -59,7 +59,6 @@ export function ProfileSettings() {
|
|||||||
const data = await res.json().catch(() => ({}));
|
const data = await res.json().catch(() => ({}));
|
||||||
setNameError(data.error || 'Failed to save name.');
|
setNameError(data.error || 'Failed to save name.');
|
||||||
} else {
|
} else {
|
||||||
await refetchSession();
|
|
||||||
setNameSaved(true);
|
setNameSaved(true);
|
||||||
setTimeout(() => setNameSaved(false), 3000);
|
setTimeout(() => setNameSaved(false), 3000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,3 +125,6 @@ CREATE TABLE IF NOT EXISTS user_profile (
|
|||||||
ALTER TABLE user_profile ALTER COLUMN pi_first_name DROP NOT NULL;
|
ALTER TABLE user_profile ALTER COLUMN pi_first_name DROP NOT NULL;
|
||||||
ALTER TABLE user_profile ALTER COLUMN bldg_code DROP NOT NULL;
|
ALTER TABLE user_profile ALTER COLUMN bldg_code DROP NOT NULL;
|
||||||
ALTER TABLE user_profile ALTER COLUMN lab DROP NOT NULL;
|
ALTER TABLE user_profile ALTER COLUMN lab DROP NOT NULL;
|
||||||
|
|
||||||
|
-- Allow name to be cleared (set to null).
|
||||||
|
ALTER TABLE "user" ALTER COLUMN "name" DROP NOT NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user