Skip to content

Commit

Permalink
Update PushSubscriptionState properties to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jennantilla committed Mar 8, 2024
1 parent 18f85af commit e1d65a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export namespace OneSignal {
'OneSignal: This method has been deprecated. Use getIdAsync instead for getting push subscription id.',
);

return pushSub.id;
return pushSub.id ? pushSub.id : '';
}

export async function getIdAsync(): Promise<string | null> {
Expand All @@ -252,7 +252,7 @@ export namespace OneSignal {
'OneSignal: This method has been deprecated. Use getTokenAsync instead for getting push subscription token.',
);

return pushSub.token;
return pushSub.token ? pushSub.token : '';
}

/** The readonly push subscription token */
Expand Down
4 changes: 2 additions & 2 deletions src/models/Subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export enum OSNotificationPermission {
}

export interface PushSubscriptionState {
id: string;
token: string;
id?: string;
token?: string;
optedIn: boolean;
}

Expand Down

0 comments on commit e1d65a5

Please sign in to comment.