File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export interface FetchInspectInfoResponse {
5252export const FetchInspectInfo = new SimpleHandler < FetchInspectInfoRequest , FetchInspectInfoResponse > (
5353 RequestType . FETCH_INSPECT_INFO ,
5454 ( req ) => {
55- const apiUrl = `https://api.csgofloat .com/?url=${ req . link } &minimal=true${
55+ const apiUrl = `https://api.csfloat .com/?url=${ req . link } &minimal=true${
5656 req . listPrice ? '&listPrice=' + req . listPrice : ''
5757 } `;
5858 return fetch ( apiUrl ) . then ( ( resp ) => {
Original file line number Diff line number Diff line change @@ -12,10 +12,28 @@ export interface FetchPendingTradesResponse {
1212export const FetchPendingTrades = new SimpleHandler < FetchPendingTradesRequest , FetchPendingTradesResponse > (
1313 RequestType . FETCH_PENDING_TRADES ,
1414 async ( req ) => {
15- return fetch ( `https://csgofloat.com/api/v1/me/pending-trades` , {
16- credentials : 'include' ,
17- } ) . then ( ( resp ) => {
15+ try {
16+ const resp = await fetch ( `https://csfloat.com/api/v1/me/pending-trades` , {
17+ credentials : 'include' ,
18+ } ) ;
19+
20+ if ( resp . status !== 200 ) {
21+ throw new Error ( 'invalid status' ) ;
22+ }
23+
1824 return resp . json ( ) as Promise < FetchPendingTradesResponse > ;
19- } ) ;
25+ } catch ( e ) {
26+ // Try the old CSGOFloat URL (in case they have an old session from there)
27+ // Of note, this can be removed ~1 week after the migration.
28+ const resp = await fetch ( `https://csgofloat.com/api/v1/me/pending-trades` , {
29+ credentials : 'include' ,
30+ } ) ;
31+
32+ if ( resp . status !== 200 ) {
33+ throw new Error ( 'invalid status' ) ;
34+ }
35+
36+ return resp . json ( ) ;
37+ }
2038 }
2139) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export interface FetchStallResponseError {
1919export const FetchStall = new SimpleHandler < FetchStallRequest , FetchStallResponse > (
2020 RequestType . FETCH_STALL ,
2121 async ( req ) => {
22- return fetch ( `https://csgofloat .com/api/v1/users/${ req . steam_id64 } /stall` ) . then ( ( resp ) => {
22+ return fetch ( `https://csfloat .com/api/v1/users/${ req . steam_id64 } /stall` ) . then ( ( resp ) => {
2323 return resp . json ( ) . then ( ( json : FetchStallResponse | FetchStallResponseError ) => {
2424 if ( resp . ok ) {
2525 return json ;
You can’t perform that action at this time.
0 commit comments