-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better state management of unstarted steps
- Loading branch information
1 parent
9832f17
commit b8c97fa
Showing
6 changed files
with
68 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
import React, {useMemo} from "react"; | ||
import {FrigadeContext} from "../FrigadeProvider"; | ||
import React, { useMemo } from 'react' | ||
import { FrigadeContext } from '../FrigadeProvider' | ||
|
||
export const API_PREFIX = 'https://api.frigade.com/v1/public/'; | ||
export const API_PREFIX = 'https://api.frigade.com/v1/public/' | ||
|
||
export const NOT_STARTED_STEP = 'NOT_STARTED_STEP' | ||
export const COMPLETED_FLOW = 'COMPLETED_FLOW' | ||
export const STARTED_FLOW = 'STARTED_FLOW' | ||
export const COMPLETED_STEP = 'COMPLETED_STEP' | ||
export const STARTED_STEP = 'STARTED_STEP' | ||
|
||
export function useConfig() { | ||
const {publicApiKey, userId} = React.useContext(FrigadeContext); | ||
const { publicApiKey, userId } = React.useContext(FrigadeContext) | ||
|
||
return { | ||
config: useMemo( | ||
() => ({ | ||
headers: { | ||
Authorization: `Bearer ${publicApiKey}`, | ||
'Content-Type': 'application/json' | ||
} | ||
'Content-Type': 'application/json', | ||
}, | ||
}), | ||
[publicApiKey, userId] | ||
) | ||
}; | ||
), | ||
} | ||
} | ||
|
||
export interface PaginatedResult<T> { | ||
data: T[]; | ||
offset: number; | ||
limit: number; | ||
data: T[] | ||
offset: number | ||
limit: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters