Log caddy request, cache in vuex WS domain changes

This commit is contained in:
Julien Nahum 2023-11-29 16:16:31 +01:00
parent b50f579155
commit ac968403b6
2 changed files with 16 additions and 2 deletions

View File

@ -21,13 +21,26 @@ class CaddyController extends Controller
]);
}
if (Workspace::whereJsonContains('custom_domains',$domain)->exists()) {
\Log::info('Caddy request received',[
'domain' => $domain,
]);
if ($workspace = Workspace::whereJsonContains('custom_domains',$domain)->first()) {
\Log::info('Caddy request successful',[
'domain' => $domain,
'workspace' => $workspace->id,
]);
return $this->success([
'success' => true,
'message' => 'OK',
]);
}
\Log::info('Caddy request failed',[
'domain' => $domain,
'workspace' => $workspace?->id,
]);
return $this->error([
'success' => false,
'message' => 'Unauthorized domain',

View File

@ -168,7 +168,8 @@ export default {
custom_domains: this.customDomains.split('\n')
.map(domain => domain.trim())
.filter(domain => domain && domain.length > 0)
}).then(() => {
}).then((response) => {
this.$store.commit('open/workspaces/addOrUpdate', response.data)
this.alertSuccess('Custom domains saved.')
}).catch((error) => {
this.alertError('Failed to update custom domains: ' + error.response.data.message)