Allow removing subdomain
This commit is contained in:
@ -24,10 +24,7 @@ const Auth = observer(({ auth, children }: Props) => {
|
|||||||
return <LoadingIndicator />;
|
return <LoadingIndicator />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (window.location.origin !== team.url) {
|
||||||
team.subdomain &&
|
|
||||||
!window.location.hostname.startsWith(team.subdomain)
|
|
||||||
) {
|
|
||||||
window.location.href = `${team.url}${window.location.pathname}`;
|
window.location.href = `${team.url}${window.location.pathname}`;
|
||||||
return <LoadingIndicator />;
|
return <LoadingIndicator />;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,8 @@ class ApiClient {
|
|||||||
const headers = new Headers({
|
const headers = new Headers({
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'cache-control': 'no-cache',
|
||||||
|
pragma: 'no-cache',
|
||||||
});
|
});
|
||||||
if (stores.auth.authenticated) {
|
if (stores.auth.authenticated) {
|
||||||
invariant(stores.auth.token, 'JWT token not set properly');
|
invariant(stores.auth.token, 'JWT token not set properly');
|
||||||
@ -52,6 +54,7 @@ class ApiClient {
|
|||||||
headers,
|
headers,
|
||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
|
cache: 'no-cache',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.status >= 200 && response.status < 300) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
|
@ -19,8 +19,8 @@ router.post('team.update', auth(), async ctx => {
|
|||||||
const team = await Team.findById(user.teamId);
|
const team = await Team.findById(user.teamId);
|
||||||
authorize(user, 'update', team);
|
authorize(user, 'update', team);
|
||||||
|
|
||||||
|
team.subdomain = subdomain === '' ? null : subdomain;
|
||||||
if (name) team.name = name;
|
if (name) team.name = name;
|
||||||
if (subdomain !== undefined) team.subdomain = subdomain;
|
|
||||||
if (sharing !== undefined) team.sharing = sharing;
|
if (sharing !== undefined) team.sharing = sharing;
|
||||||
if (avatarUrl && avatarUrl.startsWith(`${endpoint}/uploads/${user.id}`)) {
|
if (avatarUrl && avatarUrl.startsWith(`${endpoint}/uploads/${user.id}`)) {
|
||||||
team.avatarUrl = avatarUrl;
|
team.avatarUrl = avatarUrl;
|
||||||
|
Reference in New Issue
Block a user