Skip to content

Commit

Permalink
Clear referral code if invalid/claimed/expired (#6072)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Jul 19, 2024
1 parent 04660a2 commit 1787a2e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4347,8 +4347,16 @@ export class OpenChat extends OpenChatAgentWorker {
if (this._referralCode !== undefined) {
gaTrack("registered_user_with_referral_code", "registration");
}
this.clearReferralCode();
}

switch (res.kind) {
case "success":
case "referral_code_invalid":
case "referral_code_already_claimed":
case "referral_code_expired":
this.clearReferralCode();
}

return res;
})
.catch(() => ({ kind: "internal_error" }));
Expand Down

0 comments on commit 1787a2e

Please sign in to comment.