1
0
Files
nir-frontend/src/lib/types.ts
2024-05-19 19:20:22 +03:00

36 lines
658 B
TypeScript

export type ErrorResponse = {
error: string;
}
export function isErrorResponse(data: unknown): data is ErrorResponse {
return ((data as ErrorResponse).error !== undefined);
}
export type Token = {
token: string;
userId: number;
createdAt: string;
expiresAt: string;
}
export type User = {
id: number;
username: string;
avatar: string | null;
createdAt: string;
};
export type Message = {
id: number;
channelId: number;
authorId: number;
content: string;
createdAt: string;
};
export type Channel = {
id: number;
name: string;
lastMessageId: number | null;
createdAt: string;
};