mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
fix affilate register and count not increase
This commit is contained in:
@@ -184,7 +184,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
// Track affiliate registration if user came from affiliate link
|
||||
$this->tracksAffiliateRegistration->execute($user);
|
||||
$this->tracksAffiliateRegistration->execute($user, $request->get('tracking'));
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request, false));
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Models\User;
|
||||
use App\Models\UserAffiliate;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TracksAffiliateRegistration
|
||||
{
|
||||
@@ -16,13 +17,10 @@ class TracksAffiliateRegistration
|
||||
* @param User $user
|
||||
* @return Affiliate|null
|
||||
*/
|
||||
public function execute(User $user): ?Affiliate
|
||||
public function execute(User $user, string $code): ?Affiliate
|
||||
{
|
||||
// Get tracking code from cookie
|
||||
$request = request();
|
||||
$code = $request->cookie(TracksAffiliateClick::COOKIE_NAME);
|
||||
|
||||
if (!$code || !$this->isValidCode($code)) {
|
||||
Log::info('Code is not valid', ['code' => $code]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,9 @@
|
||||
|
||||
},
|
||||
submitForm(){
|
||||
this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next');
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const tracking = urlParams.get('tracking');
|
||||
this.step === 2 ? this.submit(this.route('api.account.registration.register') + (tracking ? '?tracking=' + tracking : ''), 'post', 'registrationSection', false, false) : this.changeStep('next');
|
||||
}
|
||||
},
|
||||
mixins: [registrationFormValidation]
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
@extends('layouts.base_login')
|
||||
|
||||
@section('inner_content')
|
||||
<script>
|
||||
// Immediate redirect for logged-in users (before Vue loads)
|
||||
// Since JWT tokens are in localStorage, server can't detect them
|
||||
(function() {
|
||||
const userToken = localStorage.getItem('user-token');
|
||||
if (userToken && userToken.trim()) {
|
||||
// User is logged in, redirect to dashboard
|
||||
window.location.href = '{{ route("dashboard") }}';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<transition-component group enter-class="animate__animated animate__fadeInRightBig animate__faster" leave-class="animate__animated animate__fadeOutRightBig">
|
||||
<div class="row" key="1">
|
||||
<div class="col-12 col-md p-l-0 p-r-0 p-t-15 p-b-15">
|
||||
|
||||
Reference in New Issue
Block a user