Skip to content

Commit

Permalink
Fix crash on redgifs token refresh (#1487)
Browse files Browse the repository at this point in the history
Resolves #1486
  • Loading branch information
aeharding authored May 18, 2024
1 parent ab1f0bc commit e3441de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/redgifs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CapacitorHttp } from "@capacitor/core";
// https://github.com/Redgifs/api/wiki/Temporary-tokens

interface TemporaryTokenResponse {
token: string;
token?: string;
addr: string;
agent: string;
rtfm: string;
Expand All @@ -22,6 +22,9 @@ export async function getTemporaryToken(): Promise<string> {

const response: TemporaryTokenResponse = result.data;

if (typeof response?.token !== "string")
throw new Error("Failed to get temporary redgifs token");

return response.token;
}

Expand Down

0 comments on commit e3441de

Please sign in to comment.