mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: users management
This commit is contained in:
parent
a552300e15
commit
689625b0d5
22 changed files with 621 additions and 36 deletions
|
|
@ -75,7 +75,15 @@ export const errorHandling = (res: any) => {
|
|||
return res.json();
|
||||
};
|
||||
|
||||
export const getResponseMetadata = async (fetch_result: any) => {
|
||||
|
||||
type CustomResponseTyping = {
|
||||
success: boolean;
|
||||
data: any;
|
||||
status: number;
|
||||
HTTPmessage: string;
|
||||
};
|
||||
|
||||
export const getResponseMetadata = async (fetch_result: any): Promise<CustomResponseTyping> => {
|
||||
const json = await fetch_result.json();
|
||||
if (fetch_result.status === 200) {
|
||||
return { success: true, data: json, status: fetch_result.status, HTTPmessage: fetch_result.statusText };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue