vite-project v0.0.0


Interface: AuthContextType

Defined in: src/context/AuthContext.tsx:75

Shape of the AuthContext — defines all state + actions

Properties

conversations

conversations: null | Conversations[]

Defined in: src/context/AuthContext.tsx:81

List of all conversations for the user.


createConversation()

createConversation: (conversation_name, username) => Promise<undefined | Conversations>

Defined in: src/context/AuthContext.tsx:85

Create a new conversation.

Parameters

conversation_name

string

username

string

Returns

Promise<undefined | Conversations>


createMessage()

createMessage: (conversation_id, text, role, id, feedback) => Promise<void>

Defined in: src/context/AuthContext.tsx:87

Create a new message in a conversation.

Parameters

conversation_id

string

text

string

role

string

id

string

feedback

null | boolean

Returns

Promise<void>


fetchConversations()

fetchConversations: (username) => Promise<void>

Defined in: src/context/AuthContext.tsx:95

Fetch all conversations for the user.

Parameters

username

string

Returns

Promise<void>


fetchUserMessages()

fetchUserMessages: (conversation_id) => Promise<void>

Defined in: src/context/AuthContext.tsx:89

Fetch all messages for a conversation.

Parameters

conversation_id

string

Returns

Promise<void>


loading

loading: boolean

Defined in: src/context/AuthContext.tsx:83

Loading state while verifying session.


logoutUser()

logoutUser: () => Promise<void>

Defined in: src/context/AuthContext.tsx:93

Logout the current user.

Returns

Promise<void>


RegisterUser()

RegisterUser: (username, password, email) => Promise<boolean | ErrorMessage>

Defined in: src/context/AuthContext.tsx:97

Register a new user.

Parameters

username

string

password

string

email

string

Returns

Promise<boolean | ErrorMessage>


renameConversation()

renameConversation: (conversation_name, conversation_id) => Promise<void | ErrorMessage>

Defined in: src/context/AuthContext.tsx:105

Rename a conversation.

Parameters

conversation_name

string

conversation_id

string

Returns

Promise<void | ErrorMessage>


resendCode()

resendCode: (username, email) => Promise<void>

Defined in: src/context/AuthContext.tsx:101

Resend a verification code.

Parameters

username

string

email

string

Returns

Promise<void>


user

user: null | UserProfile

Defined in: src/context/AuthContext.tsx:77

Current logged-in user, or null if unauthenticated.


userFeedback()

userFeedback: (message_id, conversation_id, feedback) => Promise<void>

Defined in: src/context/AuthContext.tsx:103

Submit feedback on a message.

Parameters

message_id

string

conversation_id

string

feedback

boolean

Returns

Promise<void>


userMessages

userMessages: null | Message[]

Defined in: src/context/AuthContext.tsx:79

Messages in the active conversation.


verifyCodeUser()

verifyCodeUser: (username, code) => Promise<boolean | ErrorMessage>

Defined in: src/context/AuthContext.tsx:99

Verify a user with a code.

Parameters

username

string

code

string

Returns

Promise<boolean | ErrorMessage>

Methods

loginUser()

loginUser(username, password): Promise<null | LoginAPIOutput | ErrorMessage>

Defined in: src/context/AuthContext.tsx:91

Login a user.

Parameters

username

string

password

string

Returns

Promise<null | LoginAPIOutput | ErrorMessage>