API redirect to back-end from nuxt
This commit is contained in:
parent
1cfd6ef163
commit
cc12a2dd1d
|
@ -28,10 +28,10 @@ class AppSumoAuthController extends Controller
|
|||
|
||||
// otherwise start login flow by passing the encrypted license key id
|
||||
if (is_null($license->user_id)) {
|
||||
return redirect(url('/register?appsumo_license='.encrypt($license->id)));
|
||||
return redirect(front_url('/register?appsumo_license='.encrypt($license->id)));
|
||||
}
|
||||
|
||||
return redirect(url('/register?appsumo_error=1'));
|
||||
return redirect(front_url('/register?appsumo_error=1'));
|
||||
}
|
||||
|
||||
private function retrieveAccessToken(string $requestCode): string
|
||||
|
@ -82,11 +82,11 @@ class AppSumoAuthController extends Controller
|
|||
if (is_null($license->user_id)) {
|
||||
$license->user_id = Auth::id();
|
||||
$license->save();
|
||||
return redirect(url('/home?appsumo_connect=1'));
|
||||
return redirect(front_url('/home?appsumo_connect=1'));
|
||||
}
|
||||
|
||||
// Licensed already attached
|
||||
return redirect(url('/home?appsumo_error=1'));
|
||||
return redirect(front_url('/home?appsumo_error=1'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -224,7 +224,6 @@ export default {
|
|||
if (responseData.form && responseData.form.cleanings && Object.keys(responseData.form.cleanings).length > 0) {
|
||||
alert.warning(responseData.message)
|
||||
} else if (responseData.message) {
|
||||
console.log(responseData.message)
|
||||
alert.success(responseData.message)
|
||||
}
|
||||
},
|
||||
|
@ -256,7 +255,6 @@ export default {
|
|||
this.amplitude.logEvent('form_saved', { form_id: this.form.id, form_slug: this.form.slug })
|
||||
this.displayFormModificationAlert(data)
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
if (error.response.status === 422) {
|
||||
this.validationErrorResponse = error.response.data
|
||||
this.showValidationErrors()
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
if (process.client) return
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
if (to.fullPath.startsWith('/api')) {
|
||||
const path = to.fullPath.replace('/api', '')
|
||||
return navigateTo(config.public.apiBase + path, { redirectCode: 301, external: true })
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue