Add update team name mutation and modal
This commit is contained in:
parent
0f59cf1b99
commit
b84aa50443
|
|
@ -11,7 +11,6 @@
|
||||||
:is="showModal"
|
:is="showModal"
|
||||||
v-if="showModal"/>
|
v-if="showModal"/>
|
||||||
<component :is="layout"/>
|
<component :is="layout"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -32,6 +31,7 @@
|
||||||
import NewNoteWizard from '@/components/notes/NewNoteWizard';
|
import NewNoteWizard from '@/components/notes/NewNoteWizard';
|
||||||
import EditNoteWizard from '@/components/notes/EditNoteWizard';
|
import EditNoteWizard from '@/components/notes/EditNoteWizard';
|
||||||
import EditClassNameWizard from '@/components/school-class/EditClassNameWizard';
|
import EditClassNameWizard from '@/components/school-class/EditClassNameWizard';
|
||||||
|
import EditTeamNameWizard from '@/components/profile/EditTeamNameWizard';
|
||||||
import FullscreenImage from '@/components/FullscreenImage';
|
import FullscreenImage from '@/components/FullscreenImage';
|
||||||
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
||||||
import FullscreenVideo from '@/components/FullscreenVideo';
|
import FullscreenVideo from '@/components/FullscreenVideo';
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
NewNoteWizard,
|
NewNoteWizard,
|
||||||
EditNoteWizard,
|
EditNoteWizard,
|
||||||
EditClassNameWizard,
|
EditClassNameWizard,
|
||||||
|
EditTeamNameWizard,
|
||||||
FullscreenImage,
|
FullscreenImage,
|
||||||
FullscreenInfographic,
|
FullscreenInfographic,
|
||||||
FullscreenVideo,
|
FullscreenVideo,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
<template>
|
||||||
|
<edit-name-wizard
|
||||||
|
:name="name"
|
||||||
|
type="Team"
|
||||||
|
@input="name = $event"
|
||||||
|
@hide="hide"
|
||||||
|
@save="save"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import me from '@/mixins/me';
|
||||||
|
import EditNameWizard from '@/components/profile/EditNameWizard';
|
||||||
|
import UPDATE_TEAM_MUTATION from '@/graphql/gql/mutations/updateTeam.gql';
|
||||||
|
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [me],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
EditNameWizard,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
team() {
|
||||||
|
return this.me.team;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.name = this.team ? this.team.name : '';
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
save() {
|
||||||
|
this.$apollo.mutate({
|
||||||
|
mutation: UPDATE_TEAM_MUTATION,
|
||||||
|
variables: {
|
||||||
|
input: {
|
||||||
|
name: this.name,
|
||||||
|
id: this.team.id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update(store, {data: {updateTeam: {team: {name}}}}) {
|
||||||
|
const query = ME_QUERY;
|
||||||
|
const data = store.readQuery({query});
|
||||||
|
data.me.team.name = name;
|
||||||
|
store.writeQuery({query, data});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hide();
|
||||||
|
},
|
||||||
|
hide() {
|
||||||
|
this.$store.dispatch('hideModal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '~styles/helpers';
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
mutation UpdateTeam($input: UpdateTeamInput!) {
|
||||||
|
updateTeam(input: $input) {
|
||||||
|
success
|
||||||
|
team {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
this.$router.push(this.teamRoute);
|
this.$router.push(this.teamRoute);
|
||||||
},
|
},
|
||||||
joinTeam(code) {
|
joinTeam(code) {
|
||||||
|
// todo
|
||||||
console.log('joinTeam', code);
|
console.log('joinTeam', code);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
:show-code="true"
|
:show-code="true"
|
||||||
:name="me.team.name"
|
:name="me.team.name"
|
||||||
title="Mein Team"
|
title="Mein Team"
|
||||||
|
@edit="editTeamName"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -53,6 +54,12 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
editTeamName() {
|
||||||
|
this.$store.dispatch('editTeamName');
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,9 +185,12 @@ export default new Vuex.Store({
|
||||||
editModule({commit}, payload) {
|
editModule({commit}, payload) {
|
||||||
commit('setEditModule', payload);
|
commit('setEditModule', payload);
|
||||||
},
|
},
|
||||||
editClassName({dispatch}, payload) {
|
editClassName({dispatch}) {
|
||||||
dispatch('showModal', 'edit-class-name-wizard');
|
dispatch('showModal', 'edit-class-name-wizard');
|
||||||
},
|
},
|
||||||
|
editTeamName({dispatch}) {
|
||||||
|
dispatch('showModal', 'edit-team-name-wizard');
|
||||||
|
},
|
||||||
deactivateUser({commit, dispatch}, payload) {
|
deactivateUser({commit, dispatch}, payload) {
|
||||||
commit('setModulePayload', payload);
|
commit('setModulePayload', payload);
|
||||||
return dispatch('showModal', 'deactivate-person');
|
return dispatch('showModal', 'deactivate-person');
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,7 @@ type CustomMutation {
|
||||||
updateOnboardingProgress: UpdateOnboardingProgress
|
updateOnboardingProgress: UpdateOnboardingProgress
|
||||||
createTeam(input: CreateTeamInput!): CreateTeamPayload
|
createTeam(input: CreateTeamInput!): CreateTeamPayload
|
||||||
joinTeam(input: JoinTeamInput!): JoinTeamPayload
|
joinTeam(input: JoinTeamInput!): JoinTeamPayload
|
||||||
|
updateTeam(input: UpdateTeamInput!): UpdateTeamPayload
|
||||||
addProject(input: AddProjectInput!): AddProjectPayload
|
addProject(input: AddProjectInput!): AddProjectPayload
|
||||||
updateProject(input: UpdateProjectInput!): UpdateProjectPayload
|
updateProject(input: UpdateProjectInput!): UpdateProjectPayload
|
||||||
deleteProject(input: DeleteProjectInput!): DeleteProjectPayload
|
deleteProject(input: DeleteProjectInput!): DeleteProjectPayload
|
||||||
|
|
@ -1300,6 +1301,18 @@ type UpdateSubmissionFeedbackPayload {
|
||||||
clientMutationId: String
|
clientMutationId: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input UpdateTeamInput {
|
||||||
|
id: ID!
|
||||||
|
name: String
|
||||||
|
clientMutationId: String
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateTeamPayload {
|
||||||
|
success: Boolean
|
||||||
|
team: TeamNode
|
||||||
|
clientMutationId: String
|
||||||
|
}
|
||||||
|
|
||||||
input UserGroupBlockVisibility {
|
input UserGroupBlockVisibility {
|
||||||
schoolClassId: ID!
|
schoolClassId: ID!
|
||||||
hidden: Boolean!
|
hidden: Boolean!
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue