MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / action

Function action

src/Components/Profile/Profile.jsx:17–37  ·  view source on GitHub ↗
({request})

Source from the content-addressed store, hash-verified

15}
16
17export async function action({request}) {
18 const formData = await request.formData();
19 const actionType = formData.get('button');
20 if (actionType === 'EditAvatar') {
21 const avatar = formData.get('avatar');
22 await uploadAvatar(avatar);
23 return redirect(request.url);
24 } else if (actionType === 'ToggleAnonymous') {
25 await toggleAnonymous()
26 return redirect('/profile');
27 } else if (actionType === 'EditContact') {
28 const contact = formData.get('contact');
29 await updateContact(contact);
30 return redirect(request.url);
31 } else if (actionType === 'Refresh') {
32 const displayName = await getDisplayName(true);
33 const metadata = await getMetadata(displayName, true);
34 await getAvatar(metadata?.Avatar, displayName, true);
35 return redirect(request.url);
36 }
37}
38
39export default function Profile() {
40 const loaderData = useLoaderData();

Callers

nothing calls this directly

Calls 6

uploadAvatarFunction · 0.90
toggleAnonymousFunction · 0.90
updateContactFunction · 0.90
getDisplayNameFunction · 0.90
getMetadataFunction · 0.90
getAvatarFunction · 0.90

Tested by

no test coverage detected