-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {EmptyRequestHandler, SimpleHandler} from './main'; | ||
import {RequestType} from './types'; | ||
|
||
export interface ProveTradesTokenRequest { | ||
token: string; | ||
} | ||
|
||
export interface ProveTradesTokenResponse { | ||
message: string; | ||
} | ||
|
||
export const ProveTradesToken = new SimpleHandler<ProveTradesTokenRequest, ProveTradesTokenResponse>( | ||
RequestType.PROVE_TRADES_TOKEN, | ||
async (req) => { | ||
const resp = await fetch(`https://csfloat.com/api/v1/trades/prove-token?token=${req.token}`, { | ||
credentials: 'include', | ||
}); | ||
|
||
if (resp.status !== 200) { | ||
throw new Error('failed to prove, are you logged into CSFloat?'); | ||
} | ||
|
||
return resp.json() as Promise<ProveTradesTokenResponse>; | ||
} | ||
); |
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 |
---|---|---|
|
@@ -14,4 +14,5 @@ export enum RequestType { | |
SEND_COOKIES, | ||
HAS_PERMISSIONS, | ||
META_SETTINGS, | ||
PROVE_TRADES_TOKEN, | ||
} |
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